db backup prior to drupal security update
[yaffs-website] / web / core / modules / outside_in / src / OutsideInManager.php
1 <?php
2
3 namespace Drupal\outside_in;
4
5 use Drupal\Core\Routing\AdminContext;
6 use Drupal\Core\Routing\RouteMatchInterface;
7 use Drupal\Core\Session\AccountInterface;
8
9 /**
10  * Manages information related to Settings Tray.
11  */
12 class OutsideInManager implements OutsideInManagerInterface {
13
14   /**
15    * The admin context service.
16    *
17    * @var \Drupal\Core\Routing\AdminContext
18    */
19   protected $adminContext;
20
21   /**
22    * The current route match.
23    *
24    * @var \Drupal\Core\Routing\RouteMatchInterface
25    */
26   protected $routeMatch;
27
28   /**
29    * The current account.
30    *
31    * @var \Drupal\Core\Session\AccountInterface
32    */
33   protected $account;
34
35   /**
36    * OutsideInManager constructor.
37    *
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.
44    */
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;
49   }
50
51   /**
52    * {@inheritdoc}
53    */
54   public function isApplicable() {
55     // Remove on Admin routes.
56     $is_admin_route = $this->adminContext->isAdminRoute();
57
58     // Remove on Block Demo page.
59     $is_admin_demo_route = $this->routeMatch->getRouteName() === 'block.admin_demo';
60
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;
64   }
65
66 }