TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
MenuContentObjectFactory Class Reference
Inheritance diagram for MenuContentObjectFactory:
SingletonInterface

Public Member Functions

 getMenuObjectByType ($type= '')
 
 registerMenuType ($type, $className)
 

Protected Attributes

 $menuTypeToClassMapping
 

Detailed Description

Factory for menu content objects. Allows overriding the default types like 'GMENU' with an own implementation (only one possible) and new types can be registered.

Definition at line 25 of file MenuContentObjectFactory.php.

Member Function Documentation

getMenuObjectByType (   $type = '')

Gets a typo script string like 'TMENU' and returns an object of this type

Parameters
string$type
Returns
AbstractMenuContentObject Menu object
Exceptions
ExceptionNoSuchMenuTypeException

Definition at line 46 of file MenuContentObjectFactory.php.

References GeneralUtility\makeInstance().

Referenced by MenuContentObjectFactoryTest\getMenuObjectByTypeThrowsExceptionForUnknownType().

registerMenuType (   $type,
  $className 
)

Register new menu type or override existing type

Parameters
string$typeMenu type to be used in TypoScript
string$classNameClass rendering the menu
Exceptions
InvalidArgumentException

Definition at line 67 of file MenuContentObjectFactory.php.

Referenced by MenuContentObjectFactoryTest\registerMenuTypeThrowsExceptionIfClassNameIsNotOfTypeString(), and MenuContentObjectFactoryTest\registerMenuTypeThrowsExceptionIfTypeIsNotOfTypeString().

Member Data Documentation

$menuTypeToClassMapping
protected
Initial value:
= [
'GMENU' => GraphicalMenuContentObject::class

Definition at line 32 of file MenuContentObjectFactory.php.