TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
MenuProcessor Class Reference
Inheritance diagram for MenuProcessor:
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
 
 $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 59 of file MenuProcessor.php.

Constructor & Destructor Documentation

__construct ( )

Constructor

Definition at line 234 of file MenuProcessor.php.

References GeneralUtility\makeInstance().

Member Function Documentation

buildConfiguration ( )
getConfigurationValue (   $key)
protected

Get configuration value from processorConfiguration

Parameters
string$key
Returns
string

Definition at line 245 of file MenuProcessor.php.

Referenced by MenuProcessor\process().

getDataAsJson ( )

Gets the data of the current record in JSON format

Returns
string JSON encoded data

Definition at line 448 of file MenuProcessor.php.

References MenuProcessor\jsonEncode().

jsonEncode (   $value)

JSON Encode

Parameters
mixed$value
Returns
string

Definition at line 472 of file MenuProcessor.php.

Referenced by MenuProcessor\getDataAsJson(), MenuProcessor\jsonEncodeUserFunc(), and MenuProcessor\replacePlaceholderInRenderedMenuItem().

jsonEncodeUserFunc (   $content,
  $conf 
)

This UserFunc encodes the content as Json

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

Definition at line 460 of file MenuProcessor.php.

References MenuProcessor\jsonEncode().

prepareConfiguration ( )

Prepare Configuration

Definition at line 271 of file MenuProcessor.php.

References MenuProcessor\$processorConfiguration.

Referenced by MenuProcessor\process().

prepareLevelConfiguration ( )
Returns
void

Definition at line 290 of file MenuProcessor.php.

Referenced by MenuProcessor\process().

prepareLevelLanguageConfiguration ( )
Returns
void

Definition at line 305 of file MenuProcessor.php.

Referenced by MenuProcessor\process().

process ( ContentObjectRenderer  $cObj,
array  $contentObjectConfiguration,
array  $processorConfiguration,
array  $processedData 
)
Parameters
ContentObjectRenderer$cObjThe data of the content element or page
array$contentObjectConfigurationThe configuration of Content Object
array$processorConfigurationThe configuration of this processor
array$processedDataKey/value store of processed data (e.g. to be passed to a Fluid View)
Returns
array the processed data as key/value store

Implements DataProcessorInterface.

Definition at line 382 of file MenuProcessor.php.

References MenuProcessor\$cObj, MenuProcessor\$menuTargetVariableName, MenuProcessor\$processorConfiguration, MenuProcessor\buildConfiguration(), MenuProcessor\getConfigurationValue(), ContentObjectRenderer\getContentObject(), MenuProcessor\prepareConfiguration(), MenuProcessor\prepareLevelConfiguration(), MenuProcessor\prepareLevelLanguageConfiguration(), and MenuProcessor\validateConfiguration().

replacePlaceholderInRenderedMenuItem (   $menuItem,
  $conf 
)

This UserFunc gets the link and the target

Parameters
array$menuItem
array$conf
Returns
void

Definition at line 484 of file MenuProcessor.php.

References MenuProcessor\jsonEncode().

validateConfiguration ( )

Validate configuration

Exceptions
InvalidArgumentException

Definition at line 255 of file MenuProcessor.php.

Referenced by MenuProcessor\process().

Member Data Documentation

$allowedConfigurationKeys
Initial value:
= [
'cache_period',
'entryLevel',
'entryLevel.',
'special',
'special.',
'minItems',
'minItems.',
'maxItems',
'maxItems.',
'begin',
'begin.',
'excludeUidList',
'excludeUidList.',
'excludeDoktypes',
'includeNotInMenu',
'alwaysActivePIDlist',
'alwaysActivePIDlist.',
'protectLvar',
'addQueryString',
'if',
'if.',
'levels',
'expandAll',
'includeSpacer',
'as',
'titleField',
'dataProcessing',
'dataProcessing.'
]

Definition at line 84 of file MenuProcessor.php.

$cObj

Definition at line 69 of file MenuProcessor.php.

Referenced by MenuProcessor\process().

$contentDataProcessor
protected

Definition at line 229 of file MenuProcessor.php.

$menuConfig
protected
Initial value:
= [
'wrap' => '[|]'
]

Definition at line 134 of file MenuProcessor.php.

$menuDefaults
Initial value:
= [
'levels' => 1

Definition at line 193 of file MenuProcessor.php.

$menuExpandAll
protected

Definition at line 209 of file MenuProcessor.php.

Referenced by MenuProcessor\buildConfiguration().

$menuIncludeSpacer
protected

Definition at line 214 of file MenuProcessor.php.

$menuLevelConfig
protected
Initial value:
= [
'doNotLinkIt' => '1'

Definition at line 141 of file MenuProcessor.php.

Referenced by MenuProcessor\buildConfiguration().

$menuLevels
protected

Definition at line 204 of file MenuProcessor.php.

Referenced by MenuProcessor\buildConfiguration().

$menuTargetVariableName
protected

Definition at line 224 of file MenuProcessor.php.

Referenced by MenuProcessor\process().

$menuTitleField
protected

Definition at line 219 of file MenuProcessor.php.

$processorConfiguration
protected

Definition at line 76 of file MenuProcessor.php.

Referenced by MenuProcessor\prepareConfiguration(), and MenuProcessor\process().

$removeConfigurationKeysForHmenu
Initial value:
= [
'levels',
'expandAll',
'includeSpacer',
'as',
'titleField',
'dataProcessing',
'dataProcessing.'
]

Definition at line 121 of file MenuProcessor.php.

const LINK_PLACEHOLDER = '###LINKPLACEHOLDER###'

Definition at line 61 of file MenuProcessor.php.

const TARGET_PLACEHOLDER = '###TARGETPLACEHOLDER###'

Definition at line 62 of file MenuProcessor.php.