/** * @test */ public function stdWrapIsAppliedToElementValue() { $input = array('value' => 'something', 'value.' => array('wrap' => 'ABC|DEF')); $inputStdWrapped = 'ABCsomethingDEF'; $element = $this->subject->createElement('textline', $input); $this->assertSame($inputStdWrapped, $element->getValue()); }
/** * @test */ public function processUsesLocalLayoutIfSet() { $processorConfig = array('layout.' => array('label' => '<div class="local"><labelvalue /></div>'), 'recipientEmail' => '*****@*****.**', 'senderEmail' => '*****@*****.**'); $typoScript = array('layout.' => array('label' => '<div class="global"><labelvalue /></div>'), '1' => 'foo', '1.' => $processorConfig); $subject = new PostProcessor($this->formProphecy->reveal(), $typoScript); $this->typoScriptFactoryProphecy->setLayoutHandler($processorConfig)->willReturn($this->typoScriptLayoutProphecy->reveal()); $this->assertEquals('', $subject->process()); }
/** * Do the post processing * * Destroys the session because it is not needed anymore * * @return string The post processing HTML */ protected function doPostProcessing() { $form = $this->typoscriptFactory->buildModelFromTyposcript($this->typoscript); $postProcessorTypoScript = array(); if (isset($this->typoscript['postProcessor.'])) { $postProcessorTypoScript = $this->typoscript['postProcessor.']; } /** @var $postProcessor \TYPO3\CMS\Form\PostProcess\PostProcessor */ $postProcessor = GeneralUtility::makeInstance(\TYPO3\CMS\Form\PostProcess\PostProcessor::class, $form, $postProcessorTypoScript); $content = $postProcessor->process(); $this->requestHandler->destroySession(); return $content; }
/** * 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; }