TYPO3 CMS  TYPO3_8-7
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 ()
 
 process (ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData)
 
 getDataAsJson ()
 
 jsonEncodeUserFunc ($content, $conf)
 
 jsonEncode ($value)
 
 replacePlaceholderInRenderedMenuItem ($menuItem, $conf)
 

Public Attributes

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

Protected Member Functions

 getConfigurationValue ($key)
 

Protected Attributes

 $processorConfiguration
 
 $menuConfig
 
 $menuLevelConfig
 
 $menuLevels
 
 $menuExpandAll
 
 $menuIncludeSpacer
 
 $menuTitleField
 
 $menuAlternativeSortingField
 
 $menuTargetVariableName
 
 $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 10 { special = list special.value.field = pages levels = 7 as = menu expandAll = 1 includeSpacer = 1 titleField = nav_title // title dataProcessing { 10 = TYPO3 10 { references.fieldName = media } } }

Definition at line 58 of file MenuProcessor.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor

Definition at line 251 of file MenuProcessor.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Member Function Documentation

◆ buildConfiguration()

◆ getConfigurationValue()

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

Get configuration value from processorConfiguration

Parameters
string$key
Returns
string

Definition at line 262 of file MenuProcessor.php.

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

◆ getDataAsJson()

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

Gets the data of the current record in JSON format

Returns
string JSON encoded data

Definition at line 474 of file MenuProcessor.php.

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

◆ jsonEncode()

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

◆ jsonEncodeUserFunc()

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 486 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 307 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 322 of file MenuProcessor.php.

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

◆ process()

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

◆ replacePlaceholderInRenderedMenuItem()

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

This UserFunc gets the link and the target

Parameters
array$menuItem
array$conf

Definition at line 509 of file MenuProcessor.php.

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

◆ validateConfiguration()

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

Validate configuration

Exceptions

Definition at line 272 of file MenuProcessor.php.

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

Member Data Documentation

◆ $allowedConfigurationKeys

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

Definition at line 83 of file MenuProcessor.php.

◆ $cObj

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

◆ $contentDataProcessor

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

Definition at line 246 of file MenuProcessor.php.

◆ $menuAlternativeSortingField

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

◆ $menuConfig

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

Definition at line 146 of file MenuProcessor.php.

◆ $menuDefaults

TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::$menuDefaults
Initial value:
= [
'levels' => 1

Definition at line 205 of file MenuProcessor.php.

◆ $menuExpandAll

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

◆ $menuIncludeSpacer

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

Definition at line 226 of file MenuProcessor.php.

◆ $menuLevelConfig

TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::$menuLevelConfig
protected
Initial value:
= [
'doNotLinkIt' => '1'

Definition at line 153 of file MenuProcessor.php.

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

◆ $menuLevels

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

◆ $menuTargetVariableName

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

◆ $menuTitleField

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

Definition at line 231 of file MenuProcessor.php.

◆ $processorConfiguration

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

◆ $removeConfigurationKeysForHmenu

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

Definition at line 129 of file MenuProcessor.php.

◆ LINK_PLACEHOLDER

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

Definition at line 60 of file MenuProcessor.php.

◆ TARGET_PLACEHOLDER

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

Definition at line 61 of file MenuProcessor.php.