summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2014-12-01 10:20:32 -0800
committerwebchick2014-12-01 10:20:32 -0800
commita30b30bf55dea7db04117e0970ff118f0859cc4e (patch)
treef39451933a8657b8b287d52c6ecae464fb70847c
parent5c82ef025ee62ab204d0b2a9479a340ba8e30aa0 (diff)
Issue #2300817 by joshi.rohit100, er.pushpinderrana, tim.plunkett, ianthomas_uk, LinL, dawehner: Remove path_is_admin() as it is deprecated
-rw-r--r--core/includes/common.inc6
-rw-r--r--core/includes/path.inc28
-rw-r--r--core/modules/block/src/Controller/BlockController.php7
3 files changed, 5 insertions, 36 deletions
diff --git a/core/includes/common.inc b/core/includes/common.inc
index f58fc1b..99a56bd 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 64f020c..56092f2 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 6207122..958b3b2 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',
)