Temporary helper function to check a path in the new routing system.
string $path: The path string as expected by drupal_valid_path().
array|NULL An array containing 'access' => TRUE or NULL for paths that were not found or the user has no access to.
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);
}
}