当前位置: 首页>>代码示例>>PHP>>正文


PHP ContentObjectRenderer::getContentObject方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::getContentObject方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentObjectRenderer::getContentObject方法的具体用法?PHP ContentObjectRenderer::getContentObject怎么用?PHP ContentObjectRenderer::getContentObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer的用法示例。


在下文中一共展示了ContentObjectRenderer::getContentObject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:44,代码来源:ContentObjectHook.php

示例2: getContentObjectCallsMakeInstanceForNewContentObjectInstance

 /**
  * @test
  * @dataProvider getContentObjectValidContentObjectsDataProvider
  * @param string $name TypoScript name of content object
  * @param string $className Expected class name
  */
 public function getContentObjectCallsMakeInstanceForNewContentObjectInstance($name, $className)
 {
     $fullClassName = 'TYPO3\\CMS\\Frontend\\ContentObject\\' . $className . 'ContentObject';
     $contentObjectInstance = $this->getMock($fullClassName, array(), array(), '', FALSE);
     \TYPO3\CMS\Core\Utility\GeneralUtility::addInstance($fullClassName, $contentObjectInstance);
     $this->assertSame($contentObjectInstance, $this->cObj->getContentObject($name));
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:13,代码来源:ContentObjectRendererTest.php

示例3: cObjGetSingleExt

 /**
  * Renders the application defined cObject FORM
  * which overrides the TYPO3 default cObject FORM
  *
  * If FORM is dedected by the ContentObjectRenderer,
  * the Extbase plugin "Form" is initialized. At this time, the
  * controller "Frontend" action "execute" does 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 = '';
     // render the FORM CE from TYPO3 < 4.6
     if ($typoScriptObjectName === 'FORM' && !empty($typoScript['useDefaultContentObject']) && ExtensionManagementUtility::isLoaded('compatibility6')) {
         $content = $contentObject->getContentObject($typoScriptObjectName)->render($typoScript);
     } elseif ($typoScriptObjectName === 'FORM') {
         $mergedTypoScript = null;
         // If the FORM configuration comes from the database
         // all TypoScript interpretation will be disabled for security.
         if ($contentObject->data['CType'] === 'mailform') {
             // If the FORM configuration comes from the database
             // and a predefined form is selected than the TypoScript
             // interpretation is allowed.
             $renderPredefinedForm = false;
             if (isset($contentObject->data['tx_form_predefinedform']) && !empty($contentObject->data['tx_form_predefinedform'])) {
                 $predefinedFormIdentifier = $contentObject->data['tx_form_predefinedform'];
                 if (isset($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_form.']['predefinedForms.'][$predefinedFormIdentifier . '.'])) {
                     $renderPredefinedForm = true;
                 } else {
                     throw new \InvalidArgumentException('No FORM configuration for identifier "' . $predefinedFormIdentifier . '" available.', 1457097250);
                 }
             }
             if ($renderPredefinedForm) {
                 $mergedTypoScript = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_form.']['predefinedForms.'][$predefinedFormIdentifier . '.'];
                 ArrayUtility::mergeRecursiveWithOverrule($mergedTypoScript, $typoScript);
             } else {
                 $bodytext = $contentObject->data['bodytext'];
                 /** @var $typoScriptParser TypoScriptParser */
                 $typoScriptParser = GeneralUtility::makeInstance(TypoScriptParser::class);
                 $typoScriptParser->parse($bodytext);
                 $mergedTypoScript = (array) $typoScriptParser->setup;
                 ArrayUtility::mergeRecursiveWithOverrule($mergedTypoScript, $typoScript);
                 // Disables TypoScript interpretation since TypoScript is handled that could contain insecure settings:
                 $mergedTypoScript[Configuration::DISABLE_CONTENT_ELEMENT_RENDERING] = true;
             }
         }
         $newTypoScript = is_array($mergedTypoScript) ? $mergedTypoScript : $typoScript;
         $extbase = GeneralUtility::makeInstance(Bootstrap::class);
         $content = $extbase->run('', array('pluginName' => 'Form', 'extensionName' => 'Form', 'vendorName' => 'TYPO3\\CMS', 'controller' => 'Frontend', 'action' => 'show', 'settings' => array('typoscript' => $newTypoScript), 'persistence' => array(), 'view' => array()));
         // Only apply stdWrap to TypoScript that was NOT created by the wizard:
         if (isset($typoScript['stdWrap.'])) {
             $content = $contentObject->stdWrap($content, $typoScript['stdWrap.']);
         }
     }
     return $content;
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:61,代码来源:ContentObjectHook.php

示例4: getContentObjectCallsMakeInstanceForNewContentObjectInstance

 /**
  * @test
  * @dataProvider getContentObjectValidContentObjectsDataProvider
  * @param string $name TypoScript name of content object
  * @param string $fullClassName Expected class name
  */
 public function getContentObjectCallsMakeInstanceForNewContentObjectInstance($name, $fullClassName)
 {
     $contentObjectInstance = $this->getMock($fullClassName, array(), array(), '', false);
     \TYPO3\CMS\Core\Utility\GeneralUtility::addInstance($fullClassName, $contentObjectInstance);
     $this->assertSame($contentObjectInstance, $this->subject->getContentObject($name));
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:12,代码来源:ContentObjectRendererTest.php

示例5: cObjGetSingleExt

 /**
  * Renders the application defined cObject FORM
  * which overrides the TYPO3 default cObject FORM
  *
  * First we make a COA_INT out of it, because it does not need to be cached
  * Then we send a FORM_INT to the COA_INT
  * When this is read, it will call the FORM class again.
  *
  * It simply calls execute because this function name is not really descriptive
  * but is needed by the core of TYPO3
  *
  * @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 \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject reference
  * @return string HTML output
  */
 public function cObjGetSingleExt($typoScriptObjectName, array $typoScript, $typoScriptKey, \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject)
 {
     $content = '';
     if ($typoScriptObjectName === 'FORM' && !empty($typoScript['useDefaultContentObject'])) {
         $content = $contentObject->getContentObject($typoScriptObjectName)->render($typoScript);
     } elseif ($typoScriptObjectName === 'FORM') {
         if ($contentObject->data['CType'] === 'mailform') {
             $bodytext = $contentObject->data['bodytext'];
             /** @var $typoScriptParser \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser */
             $typoScriptParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
             $typoScriptParser->parse($bodytext);
             $mergedTypoScript = (array) $typoScriptParser->setup;
             \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($mergedTypoScript, (array) $typoScript);
             // Disables content elements since TypoScript is handled that could contain insecure settings:
             $mergedTypoScript[\TYPO3\CMS\Form\Domain\Factory\TypoScriptFactory::PROPERTY_DisableContentElement] = TRUE;
         }
         $newTypoScript = array('10' => 'FORM_INT', '10.' => is_array($mergedTypoScript) ? $mergedTypoScript : $typoScript);
         $content = $contentObject->COBJ_ARRAY($newTypoScript, 'INT');
         // 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') {
         $this->initialize($typoScript);
         $content = $this->execute();
     }
     return $content;
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:45,代码来源:FormController.php

示例6: process

 /**
  * @param ContentObjectRenderer $cObj The data of the content element or page
  * @param array $contentObjectConfiguration The configuration of Content Object
  * @param array $processorConfiguration The configuration of this processor
  * @param array $processedData Key/value store of processed data (e.g. to be passed to a Fluid View)
  * @return array the processed data as key/value store
  */
 public function process(ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData)
 {
     $this->cObj = $cObj;
     $this->processorConfiguration = $processorConfiguration;
     // Get Configuration
     $this->menuLevels = (int) $this->getConfigurationValue('levels') ?: 1;
     $this->menuExpandAll = (int) $this->getConfigurationValue('expandAll');
     $this->menuTargetVariableName = $this->getConfigurationValue('as');
     $this->menuTitleField = $this->getConfigurationValue('titleField');
     // Build Configuration
     $this->prepareConfiguration();
     $this->prepareLevelConfiguration();
     $this->prepareLevelLanguageConfiguration();
     $this->buildConfiguration();
     // Process Configuration
     $menuContentObject = $cObj->getContentObject('HMENU');
     $renderedMenu = $menuContentObject->render($this->menuConfig);
     if (!$renderedMenu) {
         return $processedData;
     }
     // Process menu
     $menu = json_decode($renderedMenu, true);
     $processedMenu = array();
     foreach ($menu as $key => $page) {
         $processedMenu[$key] = $this->processAdditionalDataProcessors($page, $processorConfiguration);
     }
     // Return processed data
     $processedData[$this->menuTargetVariableName] = $processedMenu;
     return $processedData;
 }
开发者ID:pekue,项目名称:bootstrap_package,代码行数:37,代码来源:MenuProcessor.php

示例7: getFlagImage

 /**
  * Render the flag image for autorenderer
  *
  * @param array $language
  * @return string
  */
 protected function getFlagImage(array $language)
 {
     $conf = ['file' => $language['flagSrc'], 'altText' => $language['label'], 'titleText' => $language['label']];
     return $this->cObj->render($this->cObj->getContentObject('IMAGE'), $conf);
 }
开发者ID:fluidtypo3,项目名称:vhs,代码行数:11,代码来源:LanguageMenuViewHelper.php


注:本文中的TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::getContentObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。