function ViewsMenuLink::updateLink
Same name in other branches
- 9 core/modules/views/src/Plugin/Menu/ViewsMenuLink.php \Drupal\views\Plugin\Menu\ViewsMenuLink::updateLink()
- 8.9.x core/modules/views/src/Plugin/Menu/ViewsMenuLink.php \Drupal\views\Plugin\Menu\ViewsMenuLink::updateLink()
- 11.x core/modules/views/src/Plugin/Menu/ViewsMenuLink.php \Drupal\views\Plugin\Menu\ViewsMenuLink::updateLink()
Overrides MenuLinkInterface::updateLink
File
-
core/
modules/ views/ src/ Plugin/ Menu/ ViewsMenuLink.php, line 132
Class
- ViewsMenuLink
- Defines menu links provided by views.
Namespace
Drupal\views\Plugin\MenuCode
public function updateLink(array $new_definition_values, $persist) {
$overrides = array_intersect_key($new_definition_values, $this->overrideAllowed);
// Update the definition.
$this->pluginDefinition = $overrides + $this->pluginDefinition;
if ($persist) {
$view = $this->loadView();
$display =& $view->storage
->getDisplay($view->current_display);
// Just save the title to the original view.
$changed = FALSE;
foreach ($overrides as $key => $new_definition_value) {
if (empty($display['display_options']['menu'][$key]) || $display['display_options']['menu'][$key] != $new_definition_value) {
$display['display_options']['menu'][$key] = $new_definition_value;
$changed = TRUE;
}
}
if ($changed) {
// @todo Improve this to not trigger a full rebuild of everything, if we
// just changed some properties. https://www.drupal.org/node/2310389
$view->storage
->save();
}
}
return $this->pluginDefinition;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.