Review main Merged Breaking

95332[!!!][TASK] Register menu content objects as services

Benni Mack CR +2 V +2 Hard +294 −217 updated 08/31/26, 09:18

Commit message

The HMENU sub types like TMENU were resolved through
MenuContentObjectFactory, a singleton registry holding a hardcoded
array of TypoScript key to class name, filled at runtime via
registerMenuType() from ext_localconf.php and instantiating the menu
objects with GeneralUtility::makeInstance().

Menu content objects are now registered as services tagged with
"frontend.menucontentobject" and an "identifier" holding the
TypoScript menu type, mirroring how content objects are registered
with "frontend.contentobject":

  TYPO3\CMS\Frontend\ContentObject\Menu\TextMenuContentObject:
    tags:
      - name: frontend.menucontentobject
        identifier: 'TMENU'

A compiler pass builds a service locator over that tag and hands it
to every tagged service, together with "shared: false" - menu objects
carry state while rendering, so every HMENU level needs its own
instance. Extensions therefore only need to add the tag.

AbstractMenuContentObject receives the locator via constructor and
creates the menu object of the next level from it. The locator is
injected into HierarchicalMenuContentObject, MenuProcessor and
LanguageMenuProcessor as well.

MenuContentObjectFactory and NoSuchMenuTypeException are obsolete
with that and are removed: an unregistered menu type is now detected
with has() on the locator instead of catching an exception, which all
call sites did silently anyway.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Georg Ringer +1
    • Jochen Roth +1
  • Verified V +2 Done
    • Benni Mack +2
    • Georg Ringer +1
    • Jochen Roth +1
    • core-ci +1 CI

Issues 1

Files 13

Review log 79

  1. Benni Mack uploaded patch set 1 08/14/26, 16:53

  2. Benni Mack marked it ready for review 08/14/26, 16:53

  3. core-ci voted on patch set 1 V +1 08/14/26, 17:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106707

  4. Benni Mack rebased onto patch set 2 V +1 08/26/26, 08:46

  5. core-ci voted on patch set 2 V +1 08/26/26, 08:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107131

  6. Georg Ringer voted on patch set 2 CR +1 V +1 08/27/26, 15:51

  7. Jochen Roth voted on patch set 2 CR +1 V +1 08/31/26, 09:12

  8. Benni Mack voted on patch set 2 CR +2 V +2 08/31/26, 09:18

  9. Benni Mack merged patch set 3 08/31/26, 09:18