function _menu_router_translate_route

Translates a route name to its router item path.

Parameters

string $route_name: The route name to translate.

Return value

string The translated path pattern from the route.

Related topics

2 calls to _menu_router_translate_route()
menu_get_local_actions in drupal/core/includes/menu.inc
Returns the rendered local actions at the current level.
menu_router_build in drupal/core/includes/menu.inc
Collects and alters the menu definitions.

File

drupal/core/includes/menu.inc, line 2768
API for the Drupal menu system.

Code

function _menu_router_translate_route($route_name) {
  $route = Drupal::service('router.route_provider')
    ->getRouteByName($route_name);
  $path = trim($route
    ->getPattern(), '/');

  // Translate placeholders, e.g. {foo} -> %.
  return preg_replace('/{' . DRUPAL_PHP_FUNCTION_PATTERN . '}/', '%', $path);
}