/** * Returns TRUE if there is a submenu with items for the page id, $uid * Used by the item states "IFSUB", "ACTIFSUB" and "CURIFSUB" to check if there is a submenu * * @param integer $uid Page uid for which to search for a submenu * @return boolean Returns TRUE if there was a submenu with items found * @access private * @todo Define visibility */ public function isSubMenu($uid) { // Looking for a mount-pid for this UID since if that // exists we should look for a subpages THERE and not in the input $uid; $mount_info = $this->sys_page->getMountPointInfo($uid); if (is_array($mount_info)) { $uid = $mount_info['mount_pid']; } $recs = $this->sys_page->getMenu($uid, 'uid,pid,doktype,mount_pid,mount_pid_ol,nav_hide,shortcut,shortcut_mode,l18n_cfg'); $hasSubPages = FALSE; $bannedUids = $this->getBannedUids(); foreach ($recs as $theRec) { // no valid subpage if the document type is excluded from the menu if (GeneralUtility::inList($this->doktypeExcludeList, $theRec['doktype'])) { continue; } // No valid subpage if the page is hidden inside menus and // it wasn't forced to show such entries if ($theRec['nav_hide'] && !$this->conf['includeNotInMenu']) { continue; } // No valid subpage if the default language should be shown and the page settings // are excluding the visibility of the default language if (!$GLOBALS['TSFE']->sys_language_uid && GeneralUtility::hideIfDefaultLanguage($theRec['l18n_cfg'])) { continue; } // No valid subpage if the alternative language should be shown and the page settings // are requiring a valid overlay but it doesn't exists $hideIfNotTranslated = GeneralUtility::hideIfNotTranslated($theRec['l18n_cfg']); if ($GLOBALS['TSFE']->sys_language_uid && $hideIfNotTranslated && !$theRec['_PAGES_OVERLAY']) { continue; } // No valid subpage if the subpage is banned by excludeUidList if (in_array($theRec['uid'], $bannedUids)) { continue; } $hasSubPages = TRUE; break; } return $hasSubPages; }