Added feature #14383: Integrate hooks to backend.php to perform several customizations
authorOliver Hader <oliver.hader@typo3.org>
Sun, 30 May 2010 14:28:09 +0000 (14:28 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Sun, 30 May 2010 14:28:09 +0000 (14:28 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7757 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/backend.php

index 3627496..119d818 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-05-30  Oliver Hader  <oliver@typo3.org>
+
+       * Added feature #14383: Integrate hooks to backend.php to perform several customizations
+
 2010-05-29  Christian Kuhn  <lolli@schwarzbu.ch>
 
        * Fixed bug #12872: Use "strong" instead of "b" (Thanks to Steffen Kamper and Stefano Kowalke)
index 96a87e3..62d0e44 100644 (file)
@@ -148,6 +148,8 @@ class TYPO3backend {
                if (isset($GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW']) && (int) $GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'] != (int) $this->menuWidth) {
                        $this->menuWidth = (int) $GLOBALS['TBE_STYLES']['dims']['leftMenuFrameW'];
                }
+
+               $this->executeHook('constructPostProcess');
        }
 
        /**
@@ -185,6 +187,7 @@ class TYPO3backend {
         * @return      void
         */
        public function render()        {
+               $this->executeHook('renderPreProcess');
 
                if (t3lib_div::makeInstance('DonateWindow')->isDonateWindowAllowed()) {
                        $this->pageRenderer->addJsFile('js/donate.js');
@@ -262,6 +265,9 @@ class TYPO3backend {
                $this->content .= $backendScaffolding;
                $this->content .= $GLOBALS['TBE_TEMPLATE']->endPage();
 
+               $hookConfiguration = array('content' => &$this->content);
+               $this->executeHook('renderPostProcess', $hookConfiguration);
+
                echo $this->content;
        }
 
@@ -684,6 +690,28 @@ class TYPO3backend {
                        unset($toolbarItem);
                }
        }
+
+       /**
+        * Executes defined hooks functions for the given identifier.
+        *
+        * These hook identifiers are valid:
+        *      + constructPostProcess
+        *      + renderPreProcess
+        *      + renderPostProcess
+        *
+        * @param string $identifier Specific hook identifier
+        * @param array $hookConfiguration Additional configuration passed to hook functions
+        * @return void
+        */
+       protected function executeHook($identifier, array $hookConfiguration = array()) {
+               $options =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/backend.php'];
+
+               if(isset($options[$identifier]) && is_array($options[$identifier])) {
+                       foreach($options[$identifier] as $hookFunction) {
+                               t3lib_div::callUserFunction($hookFunction, $hookConfiguration, $this);
+                       }
+               }
+       }
 }