Project

General

Profile

Actions

Bug #102349

closed

Add Event/Hook/Whatever to modify menu item results

Added by Stefan Froemken 6 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Localization
Target version:
Start date:
2023-11-08
Due date:
% Done:

0%

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

Description

Hello,

customer want's me to hide items of a pages language menu, if there is no translation for a desired record in detailview.

As a solution I found following link:
https://gist.github.com/birger-fuehne/a8a97c94ec9346d691174462ccbfcfcc

But this solution needs access to property "itemArrayProcFunc" which is marked as invalid in TYPO3s LanguageMenuProcessor. Can you please allow that property in LanguageMenuProcessor?

A second solution could be adding an Event to that position:
https://github.com/TYPO3/typo3/blob/12.4/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php#L407

That way the amount of items is still correct and caching should be fine.

Stefan

Actions #1

Updated by Stefan Bürk 3 months ago · Edited

`LanguageMenuProcessor` is a dataProcessor. Simply add a custom
DataProcessor as a followup manipulating the result array to your
needs.

10 = TYPO3\CMS\Frontend\DataProcessing\LanguageMenuProcessor
10 {
  as = languagenavigation
}
20 = VENDOR\Extension\DataProcessing\LanguageMenuInvalidItemProcessor
20 {
  source = languagenavigation
  as = languagenavigation
}

or simply using the item information to skip rendering a not linked item
in the template

<f:if condition="{item.available}">
  <f:then><a href="{item.link}" hreflang="{item.hreflang}" title="{item.navigationTitle}"><span>{item.navigationTitle}</span></a></f:then>
  <f:else><f:else>
</f:if>

at least as a solution until something wents into the core ;)

Actions #2

Updated by Stefan Froemken 3 months ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF