function MenuLinkManager::processDefinition

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Menu/MenuLinkManager.php \Drupal\Core\Menu\MenuLinkManager::processDefinition()
  2. 10 core/lib/Drupal/Core/Menu/MenuLinkManager.php \Drupal\Core\Menu\MenuLinkManager::processDefinition()
  3. 11.x core/lib/Drupal/Core/Menu/MenuLinkManager.php \Drupal\Core\Menu\MenuLinkManager::processDefinition()

Performs extra processing on plugin definitions.

By default we add defaults for the type to the definition. If a type has additional processing logic, the logic can be added by replacing or extending this method.

Parameters

array $definition: The definition to be processed and modified by reference.

$plugin_id: The ID of the plugin this definition is being used for.

2 calls to MenuLinkManager::processDefinition()
MenuLinkManager::addDefinition in core/lib/Drupal/Core/Menu/MenuLinkManager.php
Adds a new menu link definition to the menu tree storage.
MenuLinkManager::getDefinitions in core/lib/Drupal/Core/Menu/MenuLinkManager.php

File

core/lib/Drupal/Core/Menu/MenuLinkManager.php, line 124

Class

MenuLinkManager
Manages discovery, instantiation, and tree building of menu link plugins.

Namespace

Drupal\Core\Menu

Code

protected function processDefinition(array &$definition, $plugin_id) {
    $definition = NestedArray::mergeDeep($this->defaults, $definition);
    // Typecast so NULL, no parent, will be an empty string since the parent ID
    // should be a string.
    $definition['parent'] = (string) $definition['parent'];
    $definition['id'] = $plugin_id;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.