本文整理汇总了PHP中TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::cObjGetSingle方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentObjectRenderer::cObjGetSingle方法的具体用法?PHP ContentObjectRenderer::cObjGetSingle怎么用?PHP ContentObjectRenderer::cObjGetSingle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
的用法示例。
在下文中一共展示了ContentObjectRenderer::cObjGetSingle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: convertsCommaSeparatedListFromValueToSerializedArrayOfTrimmedValues
/**
* @test
*/
public function convertsCommaSeparatedListFromValueToSerializedArrayOfTrimmedValues()
{
$list = 'abc, def, ghi, jkl, mno, pqr, stu, vwx, yz';
$expected = 'a:9:{i:0;s:3:"abc";i:1;s:3:"def";i:2;s:3:"ghi";i:3;s:3:"jkl";i:4;s:3:"mno";i:5;s:3:"pqr";i:6;s:3:"stu";i:7;s:3:"vwx";i:8;s:2:"yz";}';
$this->contentObject->start(array());
$actual = $this->contentObject->cObjGetSingle(\Tx_Solr_contentobject_Multivalue::CONTENT_OBJECT_NAME, array('value' => $list, 'separator' => ','));
$this->assertEquals($expected, $actual);
}
示例2: render
/**
* Manipulate values through TypoScript before rendering
*
* @param Answer $answer
* @param string $type "createAction", "confirmationAction", "sender", "receiver"
* @return string
*/
public function render(Answer $answer, $type)
{
$value = $this->renderChildren();
if ($answer->getField()) {
if (!empty($this->typoScriptContext[$this->typeToTsType[$type] . '.'][$answer->getField()->getMarker()])) {
$this->contentObjectRenderer->start($answer->_getProperties());
$value = $this->contentObjectRenderer->cObjGetSingle($this->typoScriptContext[$this->typeToTsType[$type] . '.'][$answer->getField()->getMarker()], $this->typoScriptContext[$this->typeToTsType[$type] . '.'][$answer->getField()->getMarker() . '.']);
}
}
return $value;
}
示例3: getScaledImagePath
/**
* Return an URL to the scaled image
*
* @param string $originalFile uid or path of the file
* @param array $imageSize width and height as keys
* @return string
*/
protected function getScaledImagePath($originalFile, $imageSize)
{
$conf = array('file' => $originalFile, 'file.' => array('height' => $imageSize['height'], 'width' => $imageSize['width']));
$imgUri = $this->cObj->cObjGetSingle('IMG_RESOURCE', $conf);
$conf = array('parameter' => $imgUri, 'forceAbsoluteUrl' => 1);
return $this->cObj->typoLink_URL($conf);
}
示例4: makeContentObject
/**
* Make content object
*
* @return string
*/
protected function makeContentObject($isSent)
{
$message = NULL;
$type = NULL;
if ($this->typoScript['messages.'][$isSent]) {
$type = $this->typoScript['messages.'][$isSent];
}
if ($this->typoScript['messages.'][$isSent . '.']) {
$message = $this->typoScript['messages.'][$isSent . '.'];
}
if (empty($message)) {
if (!empty($type)) {
$message = $type;
$type = 'TEXT';
} else {
$type = 'TEXT';
$message = $this->getLocalLanguageLabel($isSent);
}
$value['value'] = $message;
$value['wrap'] = '<p>|</p>';
} elseif (!is_array($message)) {
$value['value'] = $message;
$value['wrap'] = '<p>|</p>';
} else {
$value = $message;
}
return $this->localCobj->cObjGetSingle($type, $value);
}
示例5: getCropValue
/**
* Return the image crop suffix ("c") if set for the current imageorient
*
* @param $conf
* @return mixed
*/
public function getCropValue($conf)
{
$conf = $conf['userFunc.'];
$imageorient = $this->cObj->cObjGetSingle($conf['imageorient'], $conf['imageorient.']);
$crop = $this->collections['cropConfiguration'][$imageorient];
return $crop;
}
示例6: cObjGetSingleExt
/**
* Renders the application defined cObject FORM
* which overrides the TYPO3 default cObject FORM
*
* Convert FORM to COA_INT - COA_INT.10 = FORM_INT
* If FORM_INT is also dedected by the ContentObjectRenderer, and now
* the Extbaseplugin "Form" is initalized. At this time the
* controller "Frontend" action "execute" do the rest.
*
* @param string $typoScriptObjectName Name of the object
* @param array $typoScript TS configuration for this cObject
* @param string $typoScriptKey A string label used for the internal debugging tracking.
* @param ContentObjectRenderer $contentObject reference
* @return string HTML output
*/
public function cObjGetSingleExt($typoScriptObjectName, array $typoScript, $typoScriptKey, ContentObjectRenderer $contentObject)
{
$content = '';
if ($typoScriptObjectName === 'FORM' && !empty($typoScript['useDefaultContentObject']) && ExtensionManagementUtility::isLoaded('compatibility6')) {
$content = $contentObject->getContentObject($typoScriptObjectName)->render($typoScript);
} elseif ($typoScriptObjectName === 'FORM') {
$mergedTypoScript = null;
if ($contentObject->data['CType'] === 'mailform') {
$bodytext = $contentObject->data['bodytext'];
/** @var $typoScriptParser TypoScriptParser */
$typoScriptParser = GeneralUtility::makeInstance(TypoScriptParser::class);
$typoScriptParser->parse($bodytext);
$mergedTypoScript = (array) $typoScriptParser->setup;
ArrayUtility::mergeRecursiveWithOverrule($mergedTypoScript, $typoScript);
// Disables content elements since TypoScript is handled that could contain insecure settings:
$mergedTypoScript[Configuration::DISABLE_CONTENT_ELEMENT_RENDERING] = true;
}
$newTypoScript = array('10' => 'FORM_INT', '10.' => is_array($mergedTypoScript) ? $mergedTypoScript : $typoScript);
$content = $contentObject->cObjGetSingle('COA_INT', $newTypoScript);
// Only apply stdWrap to TypoScript that was NOT created by the wizard:
if (isset($typoScript['stdWrap.'])) {
$content = $contentObject->stdWrap($content, $typoScript['stdWrap.']);
}
} elseif ($typoScriptObjectName === 'FORM_INT') {
$extbase = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Core\Bootstrap::class);
$content = $extbase->run('', array('pluginName' => 'Form', 'extensionName' => 'Form', 'vendorName' => 'TYPO3\\CMS', 'controller' => 'Frontend', 'action' => 'show', 'settings' => array('typoscript' => $typoScript), 'persistence' => array(), 'view' => array()));
}
return $content;
}
示例7: getFromTypoScriptContentObject
/**
* Get from TypoScript content object like
*
* # direct value
* plugin.tx_powermail.settings.setup.prefill.marker = TEXT
* plugin.tx_powermail.settings.setup.prefill.marker.value = red
*
* # multiple value
* plugin.tx_powermail.settings.setup.prefill.marker.0 = TEXT
* plugin.tx_powermail.settings.setup.prefill.marker.0.value = red
*
* @return bool
*/
protected function getFromTypoScriptContentObject()
{
$selected = false;
if (isset($this->settings['prefill.'][$this->getMarker() . '.']) && is_array($this->settings['prefill.'][$this->getMarker() . '.'])) {
$this->contentObjectRenderer->start(ObjectAccess::getGettableProperties($this->getField()));
// Multivalue
if (isset($this->settings['prefill.'][$this->getMarker() . '.']['0'])) {
foreach (array_keys($this->settings['prefill.'][$this->getMarker() . '.']) as $key) {
if (stristr($key, '.')) {
continue;
}
$prefill = $this->contentObjectRenderer->cObjGetSingle($this->settings['prefill.'][$this->getMarker() . '.'][$key], $this->settings['prefill.'][$this->getMarker() . '.'][$key . '.']);
if ($prefill === $this->options[$this->index]['value'] || $prefill === $this->options[$this->index]['label']) {
$selected = true;
}
}
} else {
// Single value
$prefill = $this->contentObjectRenderer->cObjGetSingle($this->settings['prefill.'][$this->getMarker()], $this->settings['prefill.'][$this->getMarker() . '.']);
if ($prefill === $this->options[$this->index]['value'] || $prefill === $this->options[$this->index]['label']) {
$selected = true;
}
}
}
return $selected;
}
示例8: renderChildIntoParentColumn
/**
* renders the columns of the grid container and returns the actual content
*
* @param $columns
* @param array $child
* @param array $parentGridData
* @param array $parentRecordNumbers
* @param array $typoScriptSetup
*
* @return void
*/
public function renderChildIntoParentColumn($columns, &$child, &$parentGridData, &$parentRecordNumbers, $typoScriptSetup = array())
{
$column_number = (int) $child['tx_gridelements_columns'];
$columnKey = $column_number . '.';
if (!isset($typoScriptSetup['columns.'][$columnKey])) {
$columnSetupKey = 'default.';
} else {
$columnSetupKey = $columnKey;
}
if ($child['uid'] > 0) {
// update SYS_LASTCHANGED if necessary
$this->cObj->lastChanged($child['tstamp']);
$this->cObj->start(array_merge($child, $parentGridData), 'tt_content');
$parentRecordNumbers[$columnKey]++;
$this->cObj->parentRecordNumber = $parentRecordNumbers[$columnKey];
// we render each child into the children key to provide them prerendered for usage with your own templating
$child = $this->cObj->cObjGetSingle($typoScriptSetup['columns.'][$columnSetupKey]['renderObj'], $typoScriptSetup['columns.'][$columnSetupKey]['renderObj.']);
// then we assign the prerendered child to the appropriate column
if (isset($columns[$column_number])) {
$parentGridData['tx_gridelements_view_columns'][$column_number] .= $child;
}
unset($columns);
}
unset($typoScriptSetup);
}
示例9: getUserAvatar
/**
* Returns the avatar of the user as a <img...> HTML tag
*
* @param array the user data array
* @return string the HTML tag
*/
function getUserAvatar($userData)
{
$avatarImg = trim($userData['tx_mmforum_avatar']);
$feuserImg = trim($userData['image']);
$imgConf = $this->conf['list_posts.']['userinfo.']['avatar_cObj.'];
$img = '';
if ($avatarImg || $feuserImg) {
if ($avatarImg) {
$imgConf['file'] = $this->conf['path_avatar'] . $avatarImg;
} else {
// only take the first image, if there are multiple ones
if (strpos($feuserImg, ',') !== false) {
list($feuserImg) = GeneralUtility::trimExplode(',', $feuserImg);
}
if (file_exists('uploads/pics/' . $feuserImg)) {
$imgConf['file'] = 'uploads/pics/' . $feuserImg;
} else {
if (file_exists('uploads/tx_srfeuserregister/' . $feuserImg)) {
$imgConf['file'] = 'uploads/tx_srfeuserregister/' . $feuserImg;
}
}
}
$img = $this->cObj->cObjGetSingle($this->conf['list_posts.']['userinfo.']['avatar_cObj'], $imgConf);
}
return $img;
}
示例10: setOutputFormat
/**
* @return DateConverter
*/
protected function setOutputFormat()
{
$outputFormat = $this->cObj->cObjGetSingle($this->configuration['outputFormat'], $this->configuration['outputFormat.']);
if (!empty($outputFormat)) {
$this->outputFormat = $outputFormat;
}
return $this;
}
示例11: getTargetFromTypoScript
/**
* Get target from overwrite settings in TypoScript
*
* plugin.tx_powermail.settings.setup.thx.overwrite.redirect = TEXT
* plugin.tx_powermail.settings.setup.thx.overwrite.redirect.value = 123
*
* @return string|null
*/
protected function getTargetFromTypoScript()
{
$target = null;
$overwriteConfig = $this->getOverwriteTypoScript();
if (!empty($overwriteConfig['redirect.'])) {
$target = $this->contentObject->cObjGetSingle($overwriteConfig['redirect'], $overwriteConfig['redirect.']);
}
return $target;
}
示例12: render
/**
* Renders the canvas
*
* @return string
*/
public function render()
{
foreach ($this->layers as $index => $layer) {
$layerIndex = ($index + 1) * self::$layerIndexIncrement;
list($layerType, $layerConfiguration) = $layer->toArray();
$this->configuration['file.'][$layerIndex] = $layerType;
$this->configuration['file.'][$layerIndex . '.'] = $layerConfiguration;
}
return $this->contentObject->cObjGetSingle('IMG_RESOURCE', $this->configuration);
}
示例13: renderConfigurationArray
/**
* Renders a given typoscript configuration and returns the whole array with
* calculated values.
*
* @param array $settings the typoscript configuration array
* @return array the configuration array with the rendered typoscript
*/
public function renderConfigurationArray(array $settings)
{
$settings = $this->enhanceSettingsWithTypoScript($this->makeConfigurationArrayRenderable($settings));
$result = array();
foreach ($settings as $key => $value) {
if (substr($key, -1) === '.') {
$keyWithoutDot = substr($key, 0, -1);
if (array_key_exists($keyWithoutDot, $settings)) {
$result[$keyWithoutDot] = $this->contentObject->cObjGetSingle($settings[$keyWithoutDot], $value);
} else {
$result[$keyWithoutDot] = $this->renderConfigurationArray($value);
}
} else {
if (!array_key_exists($key . '.', $settings)) {
$result[$key] = $value;
}
}
}
return $result;
}
示例14: termWrapper
/**
* Renders the wrapped term using the plugin settings
*
* @param \Dpn\DpnGlossary\Domain\Model\Term
* @return string
*/
protected function termWrapper(Term $term)
{
// get content object type
$contentObjectType = $this->tsConfig['settings.']['termWraps'];
// get term wrapping settings
$wrapSettings = $this->tsConfig['settings.']['termWraps.'];
// pass term data to the cObject pseudo constructor
$this->cObj->start($term->toArray());
// return the wrapped term
return $this->cObj->cObjGetSingle($contentObjectType, $wrapSettings);
}
示例15: cObjGetSingleExt
/**
* @param string $name
* @param array $configuration
* @param string $typoscriptKey
* @param ContentObjectRenderer $contentObject
* @return string
*/
public function cObjGetSingleExt($name, array $configuration, $typoscriptKey, $contentObject)
{
$result = [];
foreach ($configuration as $key => $contentObjectName) {
if (strpos($key, '.') === false) {
$conf = $configuration[$key . '.'];
$content = $contentObject->cObjGetSingle($contentObjectName, $conf, $contentObjectName);
$result[$key] = str_replace(array("\r", "\n", "\t"), '', $content);
}
}
return json_encode($result);
}