Project

General

Profile

Actions

Bug #100319

closed

Menu generation and ATagParams not respected in menu-generated-links runtimeCache

Added by Alexander Opitz over 1 year ago. Updated 4 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2023-03-27
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:

Description

Between TYPO3 v11 and v12 the generation of the menu changed.

In https://review.typo3.org/c/Packages/TYPO3.CMS/+/72909 the handling of ATagParams was moved into AbstractMenuContentObject::menuTypoLink function, which is called from AbstractMenuContentObject::link function which uses a runtime cache. While building the cacheId the ATagParams is ignored. This leads to issues if you have 2 menues with different configs on this part, maybe more parameters aren't included in cacheId.

Maybe cross collision with removal of the cache in https://review.typo3.org/c/Packages/TYPO3.CMS/+/76384 it used an complete different way for cacheId calculation.

On my system it is a TypoScript main menu and a menu content element
My TypoScript:

lib.textmenu = HMENU
lib.textmenu {
  1 = TMENU
  1.wrap = <ul class="nav justify-content-center"> | </ul>
  1.NO.wrapItemAndSub = <li class="nav-item"> | </li>
  1.NO.ATagParams = class="nav-link" 
  1.expAll = 1
  2 < .1
  3 < .2
  4 < .3
  5 < .4
  6 < .5
  7 < .6
}


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #96486: HMENU: ATagParams is processed before the link is generatedClosedBenni Mack2022-01-07

Actions
Actions #1

Updated by Benni Mack over 1 year ago

  • Related to Bug #96486: HMENU: ATagParams is processed before the link is generated added
Actions #2

Updated by Nikita Hovratov over 1 year ago

I can confirm this. Happened on an upgrade to v12.
We have 2 menues, which generate the same menu items, but with different ATagParams (= different CSS classes).
The second menu is rendered with the CSS classes from the first menu.

How to reproduce:
- Create a styleguide Frontend tree
- Add this TypoScript:

page.2000 = HMENU
page.2000 {
    special = directory
    special.value = 740 # insert your pid of the Styleguide Frontend root page

    1 = TMENU
    1 {
      NO = 1
      NO.allWrap = <li class="nav-item">|</li>
      NO.ATagParams = class="nav-link" 
    }
}

- Open the frontend and inspect the menu

Expected: The menu items have the class "nav-link"
Actual: The class "nav-link" is missing

The first menu, which is rendered, is on the left side "mainNavigation".
Now add:

page.10.dataProcessing.10 >

And open the page again. The class "nav-link" is rendered, as there was no prior cache hit.

Actions #3

Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79575

Actions #4

Updated by Gerrit Code Review over 1 year ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79575

Actions #5

Updated by Gerrit Code Review over 1 year ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79575

Actions #6

Updated by Masod Mohmand over 1 year ago

We can confirm this too. If you have two menus on your page generating the same menu but with different ATagParams.
The AtagParams from the first one is used. But it this does not happen on all pages.

lib.testNavigation = HMENU
lib.testNavigation {
  1 = TMENU
  1 {
    expAll = 0
    wrap = <ul class="mainnavigation">|</ul>
    NO = 1
    NO {
      wrapItemAndSub = <li class="mainnavigation-item">|</li>
      ATagParams = class="test-navigation" 
    }
  }
}

lib.testNavigation1 = COA
lib.testNavigation1 {
    wrap = <nav class="navbar">|</nav>
    10 = HMENU
    10 {
        entryLevel = 0
        wrap = <ul class="navbar-nav">|</ul>
        1 = TMENU
        1 {
            expAll = 0
            NO = 1
            NO {
                wrapItemAndSub = <li class="nav-item layout-{field:layout}">|</li>
                wrapItemAndSub.insertData = 1
                ATagTitle.field = subtitle // title
                ATagParams = class="nav-link nav-link" 
            }
        }
    }
}

Actions #7

Updated by Gerrit Code Review over 1 year ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79575

Actions #8

Updated by Gerrit Code Review over 1 year ago

Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79575

Actions #9

Updated by Gerrit Code Review over 1 year ago

Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79575

Actions #10

Updated by Gerrit Code Review over 1 year ago

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79672

Actions #11

Updated by Nikita Hovratov over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #12

Updated by Benni Mack 4 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF