[FEATURE] Hook for tsfe::checkEnableFields 06/21306/4
authorAndre Hähnel <andre.haehnel@netresearch.de>
Mon, 10 Jun 2013 08:36:13 +0000 (10:36 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 23 Jun 2013 10:42:59 +0000 (12:42 +0200)
This hook for tsfe::checkEnableFields allows extensions to provide
additional rules for page visibility when parent pages have
"extend to subpages" activated.

Change-Id: I6ef68802058863c9629333b59c0806dd2ab6c471
Resolves: #48981
Releases: 6.2
Reviewed-on: https://review.typo3.org/21306
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index 6402beb..8e3404a 100644 (file)
@@ -1614,6 +1614,16 @@ class TypoScriptFrontendController {
         * @todo Define visibility
         */
        public function checkEnableFields($row, $bypassGroupCheck = FALSE) {
+               if (isset($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_checkEnableFields']) && is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_checkEnableFields'])) {
+                       $_params = array('pObj' => $this, 'row' => &$row, 'bypassGroupCheck' => &$bypassGroupCheck);
+                       foreach ($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_checkEnableFields'] as $_funcRef) {
+                               // Call hooks: If one returns FALSE, method execution is aborted with result "This record is not available"
+                               $return = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($_funcRef, $_params, $this);
+                               if ($return === FALSE) {
+                                       return FALSE;
+                               }
+                       }
+               }
                if ((!$row['hidden'] || $this->showHiddenPage) && $row['starttime'] <= $GLOBALS['SIM_ACCESS_TIME'] && ($row['endtime'] == 0 || $row['endtime'] > $GLOBALS['SIM_ACCESS_TIME']) && ($bypassGroupCheck || $this->checkPageGroupAccess($row))) {
                        return TRUE;
                }