‪TYPO3CMS  9.5
TYPO3\CMS\Frontend\DataProcessing\MenuProcessor Class Reference
Inheritance diagram for TYPO3\CMS\Frontend\DataProcessing\MenuProcessor:
TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface

Public Member Functions

 __construct ()
 
 validateConfiguration ()
 
 prepareConfiguration ()
 
 prepareLevelConfiguration ()
 
 prepareLevelLanguageConfiguration ()
 
 buildConfiguration ()
 
array process (ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData)
 
string getDataAsJson ()
 
string jsonEncodeUserFunc ($content, $conf)
 
string jsonEncode ($value)
 
array replacePlaceholderInRenderedMenuItem ($menuItem, $conf)
 

Public Attributes

const LINK_PLACEHOLDER = '###LINKPLACEHOLDER###'
 
const TARGET_PLACEHOLDER = '###TARGETPLACEHOLDER###'
 
ContentObjectRenderer $cObj
 
array $allowedConfigurationKeys
 
array $removeConfigurationKeysForHmenu
 
array $menuDefaults
 

Protected Member Functions

string getConfigurationValue ($key)
 
array processAdditionalDataProcessors ($page, $processorConfiguration)
 
SiteInterface getCurrentSite ()
 
TypoScriptFrontendController getTypoScriptFrontendController ()
 

Protected Attributes

array $processorConfiguration
 
array $menuConfig
 
array $menuLevelConfig
 
int $menuLevels
 
int $menuExpandAll
 
int $menuIncludeSpacer
 
string $menuTitleField
 
string $menuAlternativeSortingField
 
string $menuTargetVariableName
 
ContentDataProcessor $contentDataProcessor
 

Detailed Description

This menu processor utilizes HMENU to generate a json encoded menu string that will be decoded again and assigned to FLUIDTEMPLATE as variable. Additional DataProcessing is supported and will be applied to each record.

Options: as - The variable to be used within the result levels - Number of levels of the menu expandAll = If false, submenus will only render if the parent page is active includeSpacer = If true, pagetype spacer will be included in the menu titleField = Field that should be used for the title

See HMENU docs for more options. https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Hmenu/Index.html

Example TypoScript configuration:

10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor 10 { special = list special.value.field = pages levels = 7 as = menu expandAll = 1 includeSpacer = 1 titleField = nav_title // title dataProcessing { 10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor 10 { references.fieldName = media } } }

Definition at line 61 of file MenuProcessor.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::__construct ( )

Constructor

Definition at line 241 of file MenuProcessor.php.

Member Function Documentation

◆ buildConfiguration()

◆ getConfigurationValue()

string TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::getConfigurationValue (   $key)
protected

Get configuration value from processorConfiguration

Parameters
string$key
Returns
‪string

Definition at line 252 of file MenuProcessor.php.

Referenced by TYPO3\CMS\Frontend\DataProcessing\MenuProcessor\process().

◆ getCurrentSite()

SiteInterface TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::getCurrentSite ( )
protected

Returns the currently configured "site" if a site is configured (= resolved) in the current request.

Returns
‪SiteInterface
Exceptions

Definition at line 523 of file MenuProcessor.php.

References TYPO3\CMS\Frontend\DataProcessing\MenuProcessor\getTypoScriptFrontendController().

Referenced by TYPO3\CMS\Frontend\DataProcessing\MenuProcessor\prepareLevelLanguageConfiguration().

◆ getDataAsJson()

string TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::getDataAsJson ( )

Gets the data of the current record in JSON format

Returns
‪string JSON encoded data

Definition at line 470 of file MenuProcessor.php.

References TYPO3\CMS\Frontend\DataProcessing\MenuProcessor\jsonEncode().

◆ getTypoScriptFrontendController()

TypoScriptFrontendController TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::getTypoScriptFrontendController ( )
protected
Returns
‪TypoScriptFrontendController

Definition at line 532 of file MenuProcessor.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Frontend\DataProcessing\MenuProcessor\getCurrentSite().

◆ jsonEncode()

string TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::jsonEncode (   $value)

◆ jsonEncodeUserFunc()

string TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::jsonEncodeUserFunc (   $content,
  $conf 
)

This UserFunc encodes the content as Json

Parameters
string$content
array$conf
Returns
‪string JSON encoded content

Definition at line 482 of file MenuProcessor.php.

References TYPO3\CMS\Frontend\DataProcessing\MenuProcessor\jsonEncode().

◆ prepareConfiguration()

TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::prepareConfiguration ( )

◆ prepareLevelConfiguration()

TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::prepareLevelConfiguration ( )

Prepare configuration for a certain menu level in the hierarchy

Definition at line 297 of file MenuProcessor.php.

Referenced by TYPO3\CMS\Frontend\DataProcessing\MenuProcessor\process().

◆ prepareLevelLanguageConfiguration()

TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::prepareLevelLanguageConfiguration ( )

Prepare the configuration when rendering a language menu

Definition at line 312 of file MenuProcessor.php.

References TYPO3\CMS\Frontend\DataProcessing\MenuProcessor\getCurrentSite().

Referenced by TYPO3\CMS\Frontend\DataProcessing\MenuProcessor\process().

◆ process()

array TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::process ( ContentObjectRenderer  $cObj,
array  $contentObjectConfiguration,
array  $processorConfiguration,
array  $processedData 
)

◆ processAdditionalDataProcessors()

array TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::processAdditionalDataProcessors (   $page,
  $processorConfiguration 
)
protected

Process additional data processors

Parameters
array$page
array$processorConfiguration
Returns
‪array

Definition at line 451 of file MenuProcessor.php.

References TYPO3\CMS\Frontend\DataProcessing\MenuProcessor\$processorConfiguration.

Referenced by TYPO3\CMS\Frontend\DataProcessing\MenuProcessor\process().

◆ replacePlaceholderInRenderedMenuItem()

array TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::replacePlaceholderInRenderedMenuItem (   $menuItem,
  $conf 
)

This UserFunc gets the link and the target

Parameters
array$menuItem
array$conf
Returns
‪array

Definition at line 506 of file MenuProcessor.php.

References TYPO3\CMS\Frontend\DataProcessing\MenuProcessor\jsonEncode().

◆ validateConfiguration()

TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::validateConfiguration ( )

Validate configuration

Exceptions

Definition at line 262 of file MenuProcessor.php.

Referenced by TYPO3\CMS\Frontend\DataProcessing\MenuProcessor\process().

Member Data Documentation

◆ $allowedConfigurationKeys

array TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::$allowedConfigurationKeys

Allowed configuration keys for menu generation, other keys will throw an exception to prevent configuration errors.

Definition at line 83 of file MenuProcessor.php.

◆ $cObj

ContentObjectRenderer TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::$cObj

The content object renderer

Definition at line 70 of file MenuProcessor.php.

Referenced by TYPO3\CMS\Frontend\DataProcessing\MenuProcessor\process().

◆ $contentDataProcessor

ContentDataProcessor TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::$contentDataProcessor
protected

Definition at line 236 of file MenuProcessor.php.

◆ $menuAlternativeSortingField

string TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::$menuAlternativeSortingField
protected

◆ $menuConfig

array TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::$menuConfig
protected
Initial value:
= array(
'wrap' => '[|]'
)

Definition at line 145 of file MenuProcessor.php.

◆ $menuDefaults

array TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::$menuDefaults
Initial value:
= array(
'levels' => 1,
'expandAll' => 1,
'includeSpacer' => 0,
'as' => 'menu',
'titleField' => 'nav_title // title'
)

Definition at line 202 of file MenuProcessor.php.

◆ $menuExpandAll

int TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::$menuExpandAll
protected

◆ $menuIncludeSpacer

int TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::$menuIncludeSpacer
protected

Definition at line 220 of file MenuProcessor.php.

◆ $menuLevelConfig

array TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::$menuLevelConfig
protected

◆ $menuLevels

int TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::$menuLevels
protected

◆ $menuTargetVariableName

string TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::$menuTargetVariableName
protected

◆ $menuTitleField

string TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::$menuTitleField
protected

Definition at line 224 of file MenuProcessor.php.

◆ $processorConfiguration

array TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::$processorConfiguration
protected

◆ $removeConfigurationKeysForHmenu

array TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::$removeConfigurationKeysForHmenu
Initial value:
= array(
'levels',
'levels.',
'expandAll',
'expandAll.',
'includeSpacer',
'includeSpacer.',
'as',
'titleField',
'titleField.',
'dataProcessing',
'dataProcessing.'
)

Remove keys from configuration that should not be passed to HMENU to prevent configuration errors

Definition at line 129 of file MenuProcessor.php.

◆ LINK_PLACEHOLDER

const TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::LINK_PLACEHOLDER = '###LINKPLACEHOLDER###'

Definition at line 63 of file MenuProcessor.php.

◆ TARGET_PLACEHOLDER

const TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::TARGET_PLACEHOLDER = '###TARGETPLACEHOLDER###'

Definition at line 64 of file MenuProcessor.php.