Content Object

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()

Sample

// 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 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' ] ) );

getTextFlexform()

What does it do?

Returns a value from a flexform.

Header

/**
 * 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.

plugin.my_extension.my_content_element = TEXT
plugin.my_extension.my_content_element {
        data = flexform: pi_flexform:settings.title
        wrap = <h1>|</h1>
}

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.

plugin.my_extension.my_content_element = TEXT
plugin.my_extension.my_content_element {
        data = flexform: pi_flexform:settings.title
        wrap = <h1>|</h1>
        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.