Issue Bug Closed

#45254In TMENU the node is still a IFSUB when it only has subpages, which are excluded with excludeUidList

Frederik Vosberg 02/07/13, 20:17 updated 10/23/17, 22:01

Description

When you have a menu, a page, which has only one subpage, which is excluded by excludeUidList, is still a IFSUB. Example:

The page with the id 2 has one subpage with the id 37.

lib.example = HMENU
lib.example.excludeUidList = 37

The page 2 is still a IFSUB page, while the page 2 has no subs in the frontend. It’s a quite small bugfix:

In TYPO3 6.0.1 in the file typo3_src/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php in the method isSubMenu($uid) on line 1495:

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; /* #### bugfix start ### */ $bannedUids = $this->getBannedUids(); /* #### bugfix end #### */ foreach ($recs as $theRec) { // no valid subpage if the document type is excluded from the menu if (\TYPO3\CMS\Core\Utility\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 && \TYPO3\CMS\Core\Utility\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 = \TYPO3\CMS\Core\Utility\GeneralUtility::hideIfNotTranslated($theRec['l18n_cfg']); if ($GLOBALS['TSFE']->sys_language_uid && $hideIfNotTranslated && !$theRec['_PAGES_OVERLAY']) { continue; } /* ##### bugfix start ##### */ // No valid subpage if the subpage is banned by excludeUidList from being displayed if (in_array($theRec['uid'], $bannedUids)) { continue; } /* ##### bugfix end #### */ $hasSubPages = TRUE; break; } return $hasSubPages; }

The two places where I added code are commented with //added this. I hope this is right, its my first bugfix.

Reviews 2