CObjectViewHelper extends AbstractViewHelper uses CompileWithContentArgumentAndRenderStatic
This class is the implementation of a Fluid ViewHelper.
View this class in the TYPO3 ViewHelper reference: <f:cobject>
This ViewHelper renders CObjects from the global TypoScript configuration.
.. note:: You have to ensure proper escaping (htmlspecialchars/intval/etc.) on your own!
Examples
Render lib object
::
<f:cObject typoscriptObjectPath="lib.someLibObject" />
Rendered :typoscript:lib.someLibObject
.
Specify cObject data & current value
::
<f:cObject typoscriptObjectPath="lib.customHeader" data="{article}" currentValueKey="title" />
Rendered :typoscript:lib.customHeader
. Data and current value will be available in TypoScript.
Inline notation
::
{article -> f:cObject(typoscriptObjectPath: 'lib.customHeader')}
Rendered :typoscript:lib.customHeader
. Data will be available in TypoScript.
Accessing the data in TypoScript
.. code-block:: typoscript
lib.customHeader = COA lib.customHeader { 10 = TEXT 10.field = author 20 = TEXT 20.current = 1 }
When passing an object with {data}
, the properties of the object are accessible with :typoscript:.field
in
TypoScript. If only a single value is passed or the currentValueKey
is specified, :typoscript:.current = 1
can be used in the TypoScript.
Table of Contents
Properties
- $escapeChildren : bool
- Disable escaping of child nodes' output
- $escapeOutput : bool
- Disable escaping of this node's output
Methods
- initializeArguments() : void
- renderStatic() : string
- Renders the TypoScript object in the given TypoScript setup path.
- resolveContentArgumentName() : string
- Explicitly set argument name to be used as content.
- getConfigurationManager() : ConfigurationManagerInterface
- getContentObjectRenderer() : ContentObjectRenderer
- renderContentObject() : string
- Renders single content object and increases time tracker stack pointer
- resetFrontendEnvironment() : void
- Resets $GLOBALS['TSFE'] if it was previously changed by simulateFrontendEnvironment()
- simulateFrontendEnvironment() : TypoScriptFrontendController|null
- \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->cObjGetSingle() relies on $GLOBALS['TSFE']
Properties
$escapeChildren
Disable escaping of child nodes' output
protected
bool
$escapeChildren
= false
$escapeOutput
Disable escaping of this node's output
protected
bool
$escapeOutput
= false
Methods
initializeArguments()
public
initializeArguments() : void
renderStatic()
Renders the TypoScript object in the given TypoScript setup path.
public
static renderStatic(array<string|int, mixed> $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) : string
Parameters
- $arguments : array<string|int, mixed>
- $renderChildrenClosure : Closure
- $renderingContext : RenderingContextInterface
Tags
Return values
stringresolveContentArgumentName()
Explicitly set argument name to be used as content.
public
resolveContentArgumentName() : string
Return values
stringgetConfigurationManager()
protected
static getConfigurationManager() : ConfigurationManagerInterface
Return values
ConfigurationManagerInterfacegetContentObjectRenderer()
protected
static getContentObjectRenderer(ServerRequestInterface $request) : ContentObjectRenderer
Parameters
- $request : ServerRequestInterface
Return values
ContentObjectRendererrenderContentObject()
Renders single content object and increases time tracker stack pointer
protected
static renderContentObject(ContentObjectRenderer $contentObjectRenderer, array<string|int, mixed> $setup, string $typoscriptObjectPath, string $lastSegment) : string
Parameters
- $contentObjectRenderer : ContentObjectRenderer
- $setup : array<string|int, mixed>
- $typoscriptObjectPath : string
- $lastSegment : string
Return values
stringresetFrontendEnvironment()
Resets $GLOBALS['TSFE'] if it was previously changed by simulateFrontendEnvironment()
protected
static resetFrontendEnvironment(TypoScriptFrontendController|null $tsfeBackup) : void
Parameters
- $tsfeBackup : TypoScriptFrontendController|null
simulateFrontendEnvironment()
\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->cObjGetSingle() relies on $GLOBALS['TSFE']
protected
static simulateFrontendEnvironment() : TypoScriptFrontendController|null