function _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);
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!menu_link_content!menu_link_content.module/function/_menu_link_content_update_path_alias/8.1.x