Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v10 here: TYPO3 ELTS.
LanguageMenuProcessor
This menu processor generates a list of language menu items which can be
assigned to the FLUIDTEMPLATE
as a variable.
Hint
The third-party extension
b13/menus also provides
a language menu processor: \B13\
.
Refer to the manual of the extension b13/menus for more information.
Options:
if
if
-
- Type
- if condition
- Required
- false
Only if the condition is met the data processor is executed.
languages
languages
-
A list of comma-separated language IDs (e.g. 0,1,2) to use for the menu creation or
auto
to load from the site configuration.
addQueryString.exclude
addQueryString.exclude
as
as
-
- Type
- string
- Required
- false
- Default
- defaults to the fieldName
The variable name to be used in the Fluid template.
Example: Menu of all language from site configuration
Please see also About the examples.
TypoScript
Using the Language
the following scenario is possible:
tt_content {
examples_dataproclang =< lib.contentElement
examples_dataproclang {
templateName = DataProcLangMenu
dataProcessing.10 = TYPO3\CMS\Frontend\DataProcessing\LanguageMenuProcessor
dataProcessing.10 {
languages = auto
as = languageNavigation
}
}
}
The Fluid template
This generated menu can be used in Fluid like this:
<html data-namespace-typo3-fluid="true" xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">
<h2>Data in variable languageNavigation</h2>
<f:debug inline="true">{languageNavigation}</f:debug>
<h2>Output</h2>
<f:if condition="{languageNavigation}">
<ul id="language" class="language-menu">
<f:for each="{languageNavigation}" as="item">
<li class="{f:if(condition: item.active, then: 'active')}
{f:if(condition: item.available, else: ' text-muted')}">
<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>
<span>{item.navigationTitle}</span>
</f:else>
</f:if>
</li>
</f:for>
</ul>
</f:if>
</html>
Output
The array now contains information on all languages as defined in the site
configuration. As the current page is not translated into German, the
German language has the item.
set to false
. It therefore
does not get linked in the template.