diff --git a/typo3/sysext/form/Classes/Controller/FormController.php b/typo3/sysext/form/Classes/Controller/FormController.php index 81a261f..da32fc7 100644 --- a/typo3/sysext/form/Classes/Controller/FormController.php +++ b/typo3/sysext/form/Classes/Controller/FormController.php @@ -32,6 +32,8 @@ namespace TYPO3\CMS\Form\Controller; */ class FormController { + const SIGNAL_ShowForm = 'ShowForm'; + /** * The TypoScript array * @@ -60,6 +62,11 @@ class FormController { protected $validate; /** + * @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher + */ + protected $signalSlotDispatcher; + + /** * Initialisation * * @param array $typoscript TS configuration for this cObject @@ -150,7 +157,10 @@ class FormController { if ($submittedByPrefix === NULL || !empty($submittedByPrefix) && !$this->validate->isValid() || !empty($submittedByPrefix) && $this->validate->isValid() && $this->requestHandler->getPost('confirmation-false', NULL) !== NULL) { $show = TRUE; } - return $show; + + $this->emitShowFormSignal($show, $submittedByPrefix); + + return (boolean) $show; } /** @@ -223,6 +233,41 @@ class FormController { return $content; } + /** + * Emits the show form signal + * + * @param boolean $showForm Show/Hide the form + * @return void + */ + protected function emitShowFormSignal(&$showForm, $submittedByPrefix) { + $this->getSignalSlotDispatcher()->dispatch( + 'TYPO3\\CMS\\Form\\Controller', + self::SIGNAL_ShowForm, + array($this, $submittedByPrefix, &$showForm) + ); + } + + /** + * Get the SignalSlot dispatcher + * + * @return \TYPO3\CMS\Extbase\SignalSlot\Dispatcher + */ + protected function getSignalSlotDispatcher() { + if (!isset($this->signalSlotDispatcher)) { + $this->signalSlotDispatcher = $this->getObjectManager()->get('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher'); + } + return $this->signalSlotDispatcher; + } + + /** + * Get the ObjectManager + * + * @return \TYPO3\CMS\Extbase\Object\ObjectManager + */ + protected function getObjectManager() { + return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); + } + }