TextMenuContentObject::class, ]; /** * Gets a typo script string like 'TMENU' and returns an object of this type * * @throws Exception\NoSuchMenuTypeException */ public function getMenuObjectByType(string $type = ''): AbstractMenuContentObject { $upperCasedClassName = strtoupper($type); if (array_key_exists($upperCasedClassName, $this->menuTypeToClassMapping)) { /** @var AbstractMenuContentObject $object */ $object = GeneralUtility::makeInstance($this->menuTypeToClassMapping[$upperCasedClassName]); return $object; } throw new NoSuchMenuTypeException( 'Menu type ' . (string)$type . ' has no implementing class.', 1363278130 ); } /** * Register new menu type or override existing type * * @param string $type Menu type to be used in TypoScript * @param string $className Class rendering the menu */ public function registerMenuType(string $type, string $className) { $this->menuTypeToClassMapping[strtoupper($type)] = $className; } }