Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MenuLinkDefault.php

function MenuLinkDefault::updateLink

Overrides MenuLinkInterface::updateLink

File

core/lib/Drupal/Core/Menu/MenuLinkDefault.php, line 94

Class

MenuLinkDefault
Provides a default implementation for menu link plugins.

Namespace

Drupal\Core\Menu

Code

public function updateLink(array $new_definition_values, $persist) {
    // Filter the list of updates to only those that are allowed.
    $overrides = array_intersect_key($new_definition_values, $this->overrideAllowed);
    // Update the definition.
    $this->pluginDefinition = $overrides + $this->getPluginDefinition();
    if ($persist) {
        // Always save the menu name as an override to avoid defaulting to tools.
        $overrides['menu_name'] = $this->pluginDefinition['menu_name'];
        $this->staticOverride
            ->saveOverride($this->getPluginId(), $this->pluginDefinition);
    }
    return $this->pluginDefinition;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal