TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Frontend\ContentObject\Menu\MenuContentObjectFactory Class Reference
Inheritance diagram for TYPO3\CMS\Frontend\ContentObject\Menu\MenuContentObjectFactory:
TYPO3\CMS\Core\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()

TYPO3\CMS\Frontend\ContentObject\Menu\MenuContentObjectFactory::getMenuObjectByType (   $type = '')

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

Parameters
string$type
Returns
AbstractMenuContentObject Menu object
Exceptions
Exception

Definition at line 46 of file MenuContentObjectFactory.php.

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

Referenced by TYPO3\CMS\Frontend\Tests\Unit\ContentObject\Menu\MenuContentObjectFactoryTest\getMenuObjectByTypeThrowsExceptionForUnknownType().

◆ registerMenuType()

TYPO3\CMS\Frontend\ContentObject\Menu\MenuContentObjectFactory::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

Definition at line 67 of file MenuContentObjectFactory.php.

Referenced by TYPO3\CMS\Frontend\Tests\Unit\ContentObject\Menu\MenuContentObjectFactoryTest\registerMenuTypeThrowsExceptionIfClassNameIsNotOfTypeString(), and TYPO3\CMS\Frontend\Tests\Unit\ContentObject\Menu\MenuContentObjectFactoryTest\registerMenuTypeThrowsExceptionIfTypeIsNotOfTypeString().

Member Data Documentation

◆ $menuTypeToClassMapping

TYPO3\CMS\Frontend\ContentObject\Menu\MenuContentObjectFactory::$menuTypeToClassMapping
protected
Initial value:
= [
'GMENU' => GraphicalMenuContentObject::class

Definition at line 32 of file MenuContentObjectFactory.php.