You are here

function config_pages_get_route_name_from_path in Config Pages 8.3

Same name and namespace in other branches
  1. 8 config_pages.module \config_pages_get_route_name_from_path()
  2. 8.2 config_pages.module \config_pages_get_route_name_from_path()

Returns route name or false.

Parameters

string $path: Path.

Return value

string|false Route name or false.

1 call to config_pages_get_route_name_from_path()
config_pages_find_parent_route_name in ./config_pages.module
Return parent route name or false.

File

./config_pages.module, line 188
Module hooks.

Code

function config_pages_get_route_name_from_path($path) {
  $path_validator = Drupal::service('path.validator');
  $url_object = $path_validator
    ->getUrlIfValidWithoutAccessCheck($path);
  if ($url_object instanceof Url) {
    return $url_object
      ->getRouteName();
  }
  return FALSE;
}