public MenuLinkManager::getDefinitions()
Gets the definition of all plugins for this type.
Return value
mixed[] An array of plugin definitions (empty array if no definitions were found). Keys are plugin IDs.
Overrides DiscoveryInterface::getDefinitions
File
- core/lib/Drupal/Core/Menu/MenuLinkManager.php, line 164
Class
- MenuLinkManager
- Manages discovery, instantiation, and tree building of menu link plugins.
Namespace
Drupal\Core\Menu
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | public function getDefinitions() { // Since this function is called rarely, instantiate the discovery here. $definitions = $this ->getDiscovery()->getDefinitions(); $this ->moduleHandler->alter( 'menu_links_discovered' , $definitions ); foreach ( $definitions as $plugin_id => & $definition ) { $definition [ 'id' ] = $plugin_id ; $this ->processDefinition( $definition , $plugin_id ); } // If this plugin was provided by a module that does not exist, remove the // plugin definition. // @todo Address what to do with an invalid plugin. foreach ( $definitions as $plugin_id => $plugin_definition ) { if (! empty ( $plugin_definition [ 'provider' ]) && ! $this ->moduleHandler->moduleExists( $plugin_definition [ 'provider' ])) { unset( $definitions [ $plugin_id ]); } } return $definitions ; } |
Please login to continue.