_menu_link_content_update_path_alias

_menu_link_content_update_path_alias($path)

Helper function to update plugin definition using internal scheme.

Parameters

string $path: The path alias.

File

core/modules/menu_link_content/menu_link_content.module, line 53
Allows administrators to create custom menu links.

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::entityManager()
    ->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);
  }
}
doc_Drupal
2016-10-29 09:57:16
Comments
Leave a Comment

Please login to continue.