public function MenuLinkManager::getDefinition in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Menu/MenuLinkManager.php \Drupal\Core\Menu\MenuLinkManager::getDefinition()
Gets a specific plugin definition.
Parameters
string $plugin_id: A plugin id.
bool $exception_on_invalid: (optional) If TRUE, an invalid plugin ID will throw an exception.
Return value
mixed A plugin definition, or NULL if the plugin ID is invalid and $exception_on_invalid is FALSE.
Throws
\Drupal\Component\Plugin\Exception\PluginNotFoundException Thrown if $plugin_id is invalid and $exception_on_invalid is TRUE.
Overrides DiscoveryInterface::getDefinition
3 calls to MenuLinkManager::getDefinition()
- MenuLinkManager::getChildIds in core/
lib/ Drupal/ Core/ Menu/ MenuLinkManager.php - Loads all child link IDs of a given menu link, regardless of visibility.
- MenuLinkManager::getParentIds in core/
lib/ Drupal/ Core/ Menu/ MenuLinkManager.php - Loads all parent link IDs of a given menu link.
- MenuLinkManager::hasDefinition in core/
lib/ Drupal/ Core/ Menu/ MenuLinkManager.php - Indicates if a specific plugin definition exists.
File
- core/
lib/ Drupal/ Core/ Menu/ MenuLinkManager.php, line 210 - Contains \Drupal\Core\Menu\MenuLinkManager.
Class
- MenuLinkManager
- Manages discovery, instantiation, and tree building of menu link plugins.
Namespace
Drupal\Core\MenuCode
public function getDefinition($plugin_id, $exception_on_invalid = TRUE) {
$definition = $this->treeStorage
->load($plugin_id);
if (empty($definition) && $exception_on_invalid) {
throw new PluginNotFoundException($plugin_id);
}
return $definition;
}