Issue #2300817 by joshi.rohit100, er.pushpinderrana, tim.plunkett, ianthomas_uk, LinL, dawehner: Remove path_is_admin() as it is deprecated
parent
5c82ef025e
commit
a30b30bf55
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue