diff --git a/core/includes/common.inc b/core/includes/common.inc index f58fc1b0abd6..99a56bd2c940 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -1476,11 +1476,7 @@ function _drupal_add_js($data = NULL, $options = NULL) { $current_query = $request->query->all(); _url('', array('script' => &$scriptPath, 'prefix' => &$pathPrefix)); $current_path = \Drupal::routeMatch()->getRouteName() ? Url::fromRouteMatch(\Drupal::routeMatch())->getInternalPath() : ''; - $current_path_is_admin = FALSE; - // The function path_is_admin() is not available on update.php pages. - if (!(defined('MAINTENANCE_MODE'))) { - $current_path_is_admin = \Drupal::service('router.admin_context')->isAdminRoute(); - } + $current_path_is_admin = \Drupal::service('router.admin_context')->isAdminRoute(); $path = array( 'baseUrl' => $request->getBaseUrl() . '/', 'scriptPath' => $scriptPath, diff --git a/core/includes/path.inc b/core/includes/path.inc index 64f020c38bcb..56092f225916 100644 --- a/core/includes/path.inc +++ b/core/includes/path.inc @@ -38,31 +38,3 @@ function drupal_is_front_page() { function drupal_match_path($path, $patterns) { return \Drupal::service('path.matcher')->matchPath($path, $patterns); } - -/** - * Determines whether a path is in the administrative section of the site. - * - * By default, paths are considered to be non-administrative. If a path does - * not match any of the patterns in path_get_admin_paths(), or if it matches - * both administrative and non-administrative patterns, it is considered - * non-administrative. - * - * @param $path - * A Drupal path. - * - * @return - * TRUE if the path is administrative, FALSE otherwise. - * - * @deprecated Use \Drupal::service('router.admin_context')->isAdminRoute() - * service instead. - */ -function path_is_admin($path) { - try { - $parameters = \Drupal::service('router')->match('/' . $path); - $route = $parameters[RouteObjectInterface::ROUTE_OBJECT]; - return \Drupal::service('router.admin_context')->isAdminRoute($route); - } - catch (ParamNotConvertedException $e) { - return FALSE; - } -} diff --git a/core/modules/block/src/Controller/BlockController.php b/core/modules/block/src/Controller/BlockController.php index 62071222f464..958b3b2fd0e9 100644 --- a/core/modules/block/src/Controller/BlockController.php +++ b/core/modules/block/src/Controller/BlockController.php @@ -62,9 +62,10 @@ class BlockController extends ControllerBase { 'js' => array( array( // The block demonstration page is not marked as an administrative - // page by path_is_admin() function in order to use the frontend - // theme. Since JavaScript relies on a proper separation of admin - // pages, it needs to know this is an actual administrative page. + // page by \Drupal::service('router.admin_context')->isAdminRoute() + // function in order to use the frontend theme. Since JavaScript + // relies on a proper separation of admin pages, it needs to know + // this is an actual administrative page. 'data' => array('path' => array('currentPathIsAdmin' => TRUE)), 'type' => 'setting', )