[FEATURE] Insert hook into form wizard view
authorFranz Geiger <mail@fx-g.de>
Sun, 11 Mar 2012 20:58:50 +0000 (21:58 +0100)
committerAndreas Wolf <andreas.wolf@ikt-werk.de>
Sun, 1 Apr 2012 16:26:10 +0000 (18:26 +0200)
Introduces a hook in tx_form_View_Wizard_Wizard. This hook
allows extending the wizard interface by loading extending
resources. The hook is executed after all other resources have
been loaded and just before content rendering.

Use it by adding your function to the array
$TYPO3_CONF_VARS['EXTCONF']['form']['hooks']['renderWizard']

Change-Id: I4fc22d5044d2808a9dbdb5ea9b256c2427987030
Resolves: #34711
Releases: 6.0
Reviewed-on: http://review.typo3.org/9559
Reviewed-by: Andreas Wolf
Tested-by: Andreas Wolf
typo3/sysext/form/Classes/View/Wizard/Wizard.php

index 52cb256..34c5dca 100644 (file)
@@ -108,6 +108,9 @@ class tx_form_View_Wizard_Wizard extends tx_form_View_Wizard_Abstract {
                                // Setting up the buttons and markers for docheader
                        $docHeaderButtons = $this->getButtons();
                        $markers['CSH'] = $docHeaderButtons['csh'];
+
+                               // Hook
+                       $this->callRenderHook();
                }
 
                        // Getting the body content
@@ -333,6 +336,24 @@ class tx_form_View_Wizard_Wizard extends tx_form_View_Wizard_Abstract {
        }
 
        /**
+        * Hook to extend the wizard interface.
+        *
+        * The hook is called just before content rendering. Use it by adding your function to the array
+        * $TYPO3_CONF_VARS['EXTCONF']['form']['hooks']['renderWizard']
+        *
+        * @return void
+        */
+       protected function callRenderHook() {
+               $params = array();
+
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['form']['hooks']['renderWizard'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['form']['hooks']['renderWizard'] as $funcRef) {
+                               t3lib_div::callUserFunction($funcRef, $params, $this);
+                       }
+               }
+       }
+
+       /**
         * Remove the trailing dots from the values in Typoscript
         *
         * @param array $array The array with the trailing dots
@@ -430,4 +451,4 @@ class tx_form_View_Wizard_Wizard extends tx_form_View_Wizard_Abstract {
                return $bodyContent;
        }
 }
-?>
\ No newline at end of file
+?>