‪TYPO3CMS  10.4
TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper Class Reference
Inheritance diagram for TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper:

Public Member Functions

 initializeArguments ()
 

Static Public Member Functions

static mixed renderStatic (array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 

Static Protected Member Functions

static string renderContentObject (ContentObjectRenderer $contentObjectRenderer, array $setup, string $typoscriptObjectPath, string $lastSegment)
 
static ConfigurationManagerInterface getConfigurationManager ()
 
static ContentObjectRenderer getContentObjectRenderer ()
 
static simulateFrontendEnvironment ()
 
static resetFrontendEnvironment ()
 

Protected Attributes

bool $escapeChildren = false
 
bool $escapeOutput = false
 

Static Protected Attributes

static TYPO3 CMS Frontend Controller TypoScriptFrontendController $tsfeBackup
 

Detailed Description

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

::

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.

Definition at line 84 of file CObjectViewHelper.php.

Member Function Documentation

◆ getConfigurationManager()

static ConfigurationManagerInterface TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper::getConfigurationManager ( )
staticprotected
Returns
‪ConfigurationManagerInterface

Definition at line 200 of file CObjectViewHelper.php.

◆ getContentObjectRenderer()

static ContentObjectRenderer TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper::getContentObjectRenderer ( )
staticprotected
Returns
‪ContentObjectRenderer

Definition at line 208 of file CObjectViewHelper.php.

References $GLOBALS.

◆ initializeArguments()

TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper::initializeArguments ( )

Initialize arguments.

Exceptions

Definition at line 108 of file CObjectViewHelper.php.

◆ renderContentObject()

static string TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper::renderContentObject ( ContentObjectRenderer  $contentObjectRenderer,
array  $setup,
string  $typoscriptObjectPath,
string  $lastSegment 
)
staticprotected

Renders single content object and increases time tracker stack pointer

Parameters
ContentObjectRenderer$contentObjectRenderer
array$setup
string$typoscriptObjectPath
string$lastSegment
Returns
‪string

Definition at line 182 of file CObjectViewHelper.php.

References TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\cObjGetSingle().

Referenced by TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper\renderStatic().

◆ renderStatic()

static mixed TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper::renderStatic ( array  $arguments,
\Closure  $renderChildrenClosure,
RenderingContextInterface  $renderingContext 
)
static

Renders the TypoScript object in the given TypoScript setup path.

Parameters
array$arguments
\Closure$renderChildrenClosure
RenderingContextInterface$renderingContext
Returns
‪mixed
Exceptions

Definition at line 125 of file CObjectViewHelper.php.

References $GLOBALS, TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface\CONFIGURATION_TYPE_FULL_TYPOSCRIPT, TYPO3\CMS\Extbase\Reflection\ObjectAccess\getGettableProperties(), TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper\renderContentObject(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

◆ resetFrontendEnvironment()

static TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper::resetFrontendEnvironment ( )
staticprotected

Resets $GLOBALS['TSFE'] if it was previously changed by simulateFrontendEnvironment()

See also
simulateFrontendEnvironment()

Definition at line 233 of file CObjectViewHelper.php.

References $GLOBALS.

◆ simulateFrontendEnvironment()

static TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper::simulateFrontendEnvironment ( )
staticprotected

Sets the $TSFE->cObjectDepthCounter in Backend mode This somewhat hacky work around is currently needed because the cObjGetSingle() function of \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer relies on this setting

Definition at line 220 of file CObjectViewHelper.php.

References $GLOBALS.

Member Data Documentation

◆ $escapeChildren

bool TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper::$escapeChildren = false
protected

Disable escaping of child nodes' output

Definition at line 91 of file CObjectViewHelper.php.

◆ $escapeOutput

bool TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper::$escapeOutput = false
protected

Disable escaping of this node's output

Definition at line 97 of file CObjectViewHelper.php.

◆ $tsfeBackup

TYPO3 CMS Frontend Controller TypoScriptFrontendController TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper::$tsfeBackup
staticprotected

contains a backup of the current $GLOBALS['TSFE'] if used in BE mode

Definition at line 101 of file CObjectViewHelper.php.