function _drupal_valid_path_new_router

Temporary helper function to check a path in the new routing system.

Parameters

string $path: The path string as expected by drupal_valid_path().

Return value

array|NULL An array containing 'access' => TRUE or NULL for paths that were not found or the user has no access to.

1 call to _drupal_valid_path_new_router()
drupal_valid_path in drupal/core/includes/path.inc
Checks a path exists and the current user has access to it.

File

drupal/core/includes/path.inc, line 236
Functions to handle paths in Drupal.

Code

function _drupal_valid_path_new_router($path) {
  $request = Request::create('/' . $path);
  $request->attributes
    ->set('system_path', $path);
  try {
    $dc = drupal_container();
    $route = $dc
      ->get('router.dynamic')
      ->matchRequest($request);
    if (!empty($route)) {
      $dc
        ->get('access_manager')
        ->check($route['_route_object'], $request);
    }
    return array(
      'access' => TRUE,
    );
  } catch (Exception $e) {
    drupal_set_message($e
      ->getMessage(), 'menu', WATCHDOG_ERROR);
  }
}