3 namespace Drupal\outside_in;
5 use Drupal\Core\Routing\AdminContext;
6 use Drupal\Core\Routing\RouteMatchInterface;
7 use Drupal\Core\Session\AccountInterface;
10 * Manages information related to Settings Tray.
12 class OutsideInManager implements OutsideInManagerInterface {
15 * The admin context service.
17 * @var \Drupal\Core\Routing\AdminContext
19 protected $adminContext;
22 * The current route match.
24 * @var \Drupal\Core\Routing\RouteMatchInterface
26 protected $routeMatch;
29 * The current account.
31 * @var \Drupal\Core\Session\AccountInterface
36 * OutsideInManager constructor.
38 * @param \Drupal\Core\Routing\AdminContext $admin_context
39 * The admin context service.
40 * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
41 * The current route match.
42 * @param \Drupal\Core\Session\AccountInterface $account
43 * The current account.
45 public function __construct(AdminContext $admin_context, RouteMatchInterface $route_match, AccountInterface $account) {
46 $this->adminContext = $admin_context;
47 $this->routeMatch = $route_match;
48 $this->account = $account;
54 public function isApplicable() {
55 // Remove on Admin routes.
56 $is_admin_route = $this->adminContext->isAdminRoute();
58 // Remove on Block Demo page.
59 $is_admin_demo_route = $this->routeMatch->getRouteName() === 'block.admin_demo';
61 // @todo Check if there is actually a different admin theme.
62 // https://www.drupal.org/node/2784853
63 return $this->account->hasPermission('administer blocks') && !$is_admin_route && !$is_admin_demo_route;