Ejemplo n.º 1
0
 /**
  * Set up
  */
 protected function setUp()
 {
     $this->singletonInstances = GeneralUtility::getSingletonInstances();
     $this->formProphecy = $this->prophesize('TYPO3\\CMS\\Form\\Domain\\Model\\Form');
     $this->typoScriptFactoryProphecy = $this->prophesize('TYPO3\\CMS\\Form\\Domain\\Factory\\TypoScriptFactory');
     $this->typoScriptFactoryProphecy->getLayoutFromTypoScript(Argument::any())->willReturn(array());
     GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Form\\Domain\\Factory\\TypoScriptFactory', $this->typoScriptFactoryProphecy->reveal());
     $this->typoScriptLayoutProphecy = $this->prophesize('TYPO3\\CMS\\Form\\Layout');
     $templateServiceProphecy = $this->prophesize('TYPO3\\CMS\\Core\\TypoScript\\TemplateService');
     $templateServiceProphecy->sortedKeyList(Argument::any())->willReturn(array(10, 20));
     GeneralUtility::addInstance('TYPO3\\CMS\\Core\\TypoScript\\TemplateService', $templateServiceProphecy->reveal());
 }
Ejemplo n.º 2
0
 /**
  * The main method called by the controller
  *
  * Iterates over the configured post processors and calls them with their
  * own settings
  *
  * @return string HTML messages from the called processors
  */
 public function process()
 {
     $html = '';
     if (is_array($this->typoScript)) {
         $keys = \TYPO3\CMS\Core\TypoScript\TemplateService::sortedKeyList($this->typoScript);
         foreach ($keys as $key) {
             if (!(int) $key || strpos($key, '.') !== FALSE) {
                 continue;
             }
             $className = FALSE;
             $processorName = $this->typoScript[$key];
             $processorArguments = array();
             if (isset($this->typoScript[$key . '.'])) {
                 $processorArguments = $this->typoScript[$key . '.'];
             }
             if (isset($processorArguments['layout.'])) {
                 $layoutHandler = $this->typoscriptFactory->setLayoutHandler($processorArguments);
             } else {
                 $layoutHandler = $this->typoscriptFactory->setLayoutHandler($this->typoScript);
             }
             if (class_exists($processorName, TRUE)) {
                 $className = $processorName;
             } else {
                 $classNameExpanded = 'TYPO3\\CMS\\Form\\PostProcess\\' . ucfirst(strtolower($processorName)) . 'PostProcessor';
                 if (class_exists($classNameExpanded, TRUE)) {
                     $className = $classNameExpanded;
                 }
             }
             if ($className !== FALSE) {
                 $layout = $this->typoscriptFactory->getLayoutFromTypoScript($this->typoScript[$processorName . '.']);
                 $layoutHandler->setLayout($layout);
                 $processor = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className, $this->form, $processorArguments);
                 if ($processor instanceof PostProcessorInterface) {
                     $html .= $processor->process();
                 }
             }
         }
     }
     return $html;
 }
Ejemplo n.º 3
0
 /**
  * Render the confirmation screen
  *
  * Stores the submitted data in a session
  *
  * @return string The confirmation screen HTML
  */
 protected function renderConfirmation()
 {
     $confirmationTyposcript = array();
     if (isset($this->typoscript['confirmation.'])) {
         $confirmationTyposcript = $this->typoscript['confirmation.'];
     }
     $layout = $this->typoscriptFactory->getLayoutFromTypoScript($confirmationTyposcript);
     $form = $this->typoscriptFactory->buildModelFromTyposcript($this->typoscript);
     $this->layoutHandler->setLayout($layout);
     $this->requestHandler->storeSession();
     /** @var $view \TYPO3\CMS\Form\View\Confirmation\ConfirmationView */
     $view = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\View\\Confirmation\\ConfirmationView', $form, $confirmationTyposcript);
     return $view->get();
 }