Exemplo n.º 1
0
 /**
  * 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;
 }