Drupal 8 install site with Drush


drush site-install standard install_configure_form.site_default_country=FR my_profile_form.my_settings.key=value
Advertisements

Drupal 8 is admin path


To check the path of the current page:

$is_admin = \Drupal::service('router.admin_context')->isAdminRoute();

to check an arbitrary path, you need to create a Request object and obtain its matching Route:

use Symfony\Component\HttpFoundation\Request;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;

$path = '/node/1';
$request = Request::create($path);

$route_match = \Drupal::service('router.no_access_checks')->matchRequest($request);
$route = $route_match[RouteObjectInterface::ROUTE_OBJECT];
$is_admin = \Drupal::service('router.admin_context')->isAdminRoute($route);

 

via: https://api.drupal.org/comment/60024#comment-60024