Bug #45254

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

Added by Frederik Vosberg almost 9 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Category:
Content Rendering
Target version:
Start date:
2013-02-07
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.0
PHP Version:
5.3
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

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.


Files

AbstractMenuContentObject.bugfixed.php (72.6 KB) AbstractMenuContentObject.bugfixed.php Bugfixed version Frederik Vosberg, 2013-02-07 20:17
AbstractMenuContentObject.php (72.5 KB) AbstractMenuContentObject.php Not bugfixed for diff Frederik Vosberg, 2013-02-07 20:17
issue_45254_v1.patch (1.22 KB) issue_45254_v1.patch Patch derived from suggested solution Thorsten Kahler, 2013-02-08 10:13

Related issues

Related to TYPO3 Core - Bug #47449: Incomplete mock raises PHP 5.4 warningClosed2013-04-22

Actions
#1

Updated by Thorsten Kahler almost 9 years ago

Seems valid by looking at the code.

#2

Updated by Frederik Vosberg almost 9 years ago

Have I to commit this to gerrit? Sorry I am new to this.

#3

Updated by Thorsten Kahler almost 9 years ago

  • Assignee set to Thorsten Kahler

No, adding a patch here is absolutely sufficient, though using the unified format (diff -u) helps identifying the changes.

#4

Updated by Gerrit Code Review almost 9 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18214

#5

Updated by Gerrit Code Review almost 9 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18214

#6

Updated by Gerrit Code Review almost 9 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18214

#7

Updated by Chris topher almost 9 years ago

  • Subject changed from In TMENU the node is still a IFSUB when it has a dont respected childpage. to In TMENU the node is still a IFSUB when it only has subpages, which are excluded with excludeUidList
#8

Updated by Jigal van Hemert almost 9 years ago

Doubt a bit if this should go to earlier branches. Although it fixes a bug the menu rendering in existing sites could be changed because of this patch. I'll ask the RMs for their opinions.

#9

Updated by Ernesto Baschny almost 9 years ago

Usually I would say "don't need such a fix in 4.5" because of the late state we have are in the LTS - it's usually not worth the hassle.

On the other hand, it only changes the state of the rendered menus, not the content of the menus themselves. So where we once had a visual hint of "sub pages" with the fix it will be gone (which is a good thing).

So +1 if anyone is willing to backport that for 4.5 (and then probably then also in later still supported versions).

#10

Updated by Frederik Vosberg almost 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 20 to 100
#11

Updated by Gerrit Code Review almost 9 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_6-0 has been pushed to the review server.
It is available at https://review.typo3.org/20037

#12

Updated by Gerrit Code Review almost 9 years ago

Patch set 1 for branch TYPO3_4-7 has been pushed to the review server.
It is available at https://review.typo3.org/20038

#13

Updated by Jigal van Hemert almost 9 years ago

  • Status changed from Under Review to Resolved
#14

Updated by Gerrit Code Review almost 9 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at https://review.typo3.org/20039

#15

Updated by Jigal van Hemert almost 9 years ago

  • Status changed from Under Review to Resolved
#16

Updated by Riccardo De Contardi about 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF