function _menu_link_content_update_path_alias
Same name and namespace in other branches
- 10 core/modules/menu_link_content/menu_link_content.module \_menu_link_content_update_path_alias()
- 9 core/modules/menu_link_content/menu_link_content.module \_menu_link_content_update_path_alias()
- 8.9.x core/modules/menu_link_content/menu_link_content.module \_menu_link_content_update_path_alias()
- main 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.
Deprecated
in drupal:11.4.0 and is removed from drupal:12.0.0. There is no replacement.
See also
https://www.drupal.org/node/3566774
File
-
core/
modules/ menu_link_content/ menu_link_content.module, line 18
Code
function _menu_link_content_update_path_alias($path) : void {
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. There is no replacement. See https://www.drupal.org/node/3566774', E_USER_DEPRECATED);
/** @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.