.. ================================================== .. FOR YOUR INFORMATION .. -------------------------------------------------- .. -*- coding: utf-8 -*- with BOM. .. include:: ../../../../Includes.txt .. _developers_methods_frontend_contentobject: Content Object ============== .. _methods_frontend_contentobject_ContentObjectRenderer_cObjGetSingle: cObjGetSingle() --------------- What does it do? ^^^^^^^^^^^^^^^^ The following wrapper methods for ContentObject rendering within ContentObjectRenderer have been marked for removal for TYPO3 CMS 8. The refresh method cObjGetSingle() manages it. * CASEFUNC() * CLEARGIF() * COBJ_ARRAY() * COLUMNS() * CONTENT() * CTABLE() * FILE() * FILES() * FLOWPLAYER() * FLUIDTEMPLATE() * FORM() * HMENU() * HRULER() * IMAGE() * IMG_RESOURCE() * IMGTEXT() * LOAD_REGISTER() * MEDIA() * MULTIMEDIA() * OTABLE() * QTOBJECT() * RECORDS() * SEARCHRESULT() * SVG() * SWFOBJECT() * TEMPLATE() * TEXT() * USER() Header ^^^^^^ .. code:: php /** * Manages deprecation #64388 - Direct ContentObject methods within ContentObjectRenderer * * @param object Current local cObject * @param string cObject method * @param array params for cObject method * @return string rendered cObject * @internal #i0008 * @access public * @version 2.1.0 * @since 2.1.0 */ public static function cObjGetSingle( &$cObj, $method, $conf ) Sample ^^^^^^ .. code:: php // IMAGE $img = \Netzmacher\Refresh\Compatibility\Frontend\ContentObject\ContentObjectRenderer::cObjGetSingle( $this->cObj, 'IMAGE', $_conf ); // LOAD_REGISTER $_conf = array( 'newsKeywords' => $row[ 'keywords' ], 'newsSubheader' => $row[ 'short' ] ); \Netzmacher\Refresh\Compatibility\Frontend\ContentObject\ContentObjectRenderer::cObjGetSingle( $this->cObj, 'LOAD_REGISTER', $_conf ); Refresh ^^^^^^^ .. code:: php // Code from TYPO3 6.2 to 7.6 $img = $this->cObj->IMAGE( $catPicConf[ 'image.' ] ); $this->cObj->LOAD_REGISTER( array( 'newsCategoryUid' => $val[ 'catid' ] ), '' ); // Code from TYPO3 6.2 to 9.x $img = \Netzmacher\Refresh\Compatibility\Frontend\ContentObject\ContentObjectRenderer::cObjGetSingle( $this->cObj, 'IMAGE', $catPicConf[ 'image.' ] ); \Netzmacher\Refresh\Compatibility\Frontend\ContentObject\ContentObjectRenderer::cObjGetSingle( $this->cObj, 'LOAD_REGISTER', array( 'newsCategoryUid' => $val[ 'catid' ] ) ); .. _methods_frontend_contentobject_ContentObjectRenderer_getTextFlexform: getTextFlexform() ----------------- What does it do? ^^^^^^^^^^^^^^^^ Returns a value from a flexform. Header ^^^^^^ .. code:: php /** * Returns a value from a flexform * * @param string Empty string (no content to process) * @param array TypoScript configuration * @return string Value from the flexform * @access public */ public function getTextFlexform( $content, $conf ) Samples ^^^^^^^ **TYPO3 8.7** TYPO3 8.7 extends TypoScript with the new getText key flexform. You can get a value from a flexform by one line TypoScript. .. code:: php plugin.my_extension.my_content_element = TEXT plugin.my_extension.my_content_element { data = flexform: pi_flexform:settings.title wrap =

|

} See details at: https://docs.typo3.org/typo3cms/TyposcriptReference/DataTypes/Gettext/Index.html#flexform **TYPO3 from 6.2 to 9.x** You can use the snippet from above in your TypoScript with the TYPO3 versions 6.2 and 7.6 by a Refresh-userFunc. The userFunc is called only, if the new property "data = flexform:" failes. .. code:: php plugin.my_extension.my_content_element = TEXT plugin.my_extension.my_content_element { data = flexform: pi_flexform:settings.title wrap =

|

ifEmpty { stdWrap { cObject = USER cObject { userFunc = Netzmacher\Refresh\Compatibility\Frontend\ContentObject\ContentObjectRenderer->getTextFlexform data = flexform: pi_flexform:settings.title dontdebug = 0 } } } } The snippet from bove runs proper with TYPO3 from 6.2 to 9.x. Refresh ^^^^^^^ See section "TYPO3 from 6.2 to 9.x" above.