function MenuLinkContent::updateLink
Same name in other branches
- 9 core/modules/menu_link_content/src/Plugin/Menu/MenuLinkContent.php \Drupal\menu_link_content\Plugin\Menu\MenuLinkContent::updateLink()
- 10 core/modules/menu_link_content/src/Plugin/Menu/MenuLinkContent.php \Drupal\menu_link_content\Plugin\Menu\MenuLinkContent::updateLink()
- 11.x core/modules/menu_link_content/src/Plugin/Menu/MenuLinkContent.php \Drupal\menu_link_content\Plugin\Menu\MenuLinkContent::updateLink()
Overrides MenuLinkInterface::updateLink
File
-
core/
modules/ menu_link_content/ src/ Plugin/ Menu/ MenuLinkContent.php, line 229
Class
- MenuLinkContent
- Provides the menu link plugin for content menu links.
Namespace
Drupal\menu_link_content\Plugin\MenuCode
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) {
$entity = $this->getEntity();
foreach ($overrides as $key => $value) {
$entity->{$key}->value = $value;
}
$entity->save();
}
return $this->pluginDefinition;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.