function _menu_link_content_update_path_alias
Same name in other branches
- 9 core/modules/menu_link_content/menu_link_content.module \_menu_link_content_update_path_alias()
- 10 core/modules/menu_link_content/menu_link_content.module \_menu_link_content_update_path_alias()
- 11.x core/modules/menu_link_content/menu_link_content.module \_menu_link_content_update_path_alias()
Helper function to update plugin definition using internal scheme.
Parameters
string $path: The path alias.
3 calls to _menu_link_content_update_path_alias()
- menu_link_content_path_alias_delete in core/
modules/ menu_link_content/ menu_link_content.module - Implements hook_ENTITY_TYPE_delete() for 'path_alias'.
- menu_link_content_path_alias_insert in core/
modules/ menu_link_content/ menu_link_content.module - Implements hook_ENTITY_TYPE_insert() for 'path_alias'.
- menu_link_content_path_alias_update in core/
modules/ menu_link_content/ menu_link_content.module - Implements hook_ENTITY_TYPE_update() for 'path_alias'.
File
-
core/
modules/ menu_link_content/ menu_link_content.module, line 66
Code
function _menu_link_content_update_path_alias($path) {
/** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
$menu_link_manager = \Drupal::service('plugin.manager.menu.link');
/** @var \Drupal\menu_link_content\MenuLinkContentInterface[] $entities */
$entities = \Drupal::entityTypeManager()->getStorage('menu_link_content')
->loadByProperties([
'link.uri' => 'internal:' . $path,
]);
foreach ($entities as $menu_link) {
$menu_link_manager->updateDefinition($menu_link->getPluginId(), $menu_link->getPluginDefinition(), FALSE);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.