summaryrefslogtreecommitdiffstats
path: root/core/modules/settings_tray/src/Access/BlockHasOverridesAccessCheck.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/settings_tray/src/Access/BlockHasOverridesAccessCheck.php')
-rw-r--r--core/modules/settings_tray/src/Access/BlockHasOverridesAccessCheck.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/core/modules/settings_tray/src/Access/BlockHasOverridesAccessCheck.php b/core/modules/settings_tray/src/Access/BlockHasOverridesAccessCheck.php
new file mode 100644
index 0000000..b21f8f4
--- /dev/null
+++ b/core/modules/settings_tray/src/Access/BlockHasOverridesAccessCheck.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Drupal\settings_tray\Access;
+
+use Drupal\block\BlockInterface;
+use Drupal\Core\Access\AccessResult;
+use Drupal\Core\Routing\Access\AccessInterface;
+
+/**
+ * Determines whether the requested block has a 'settings_tray' form.
+ *
+ * @internal
+ */
+class BlockHasOverridesAccessCheck implements AccessInterface {
+
+ /**
+ * Checks access for accessing a block's 'settings_tray' form.
+ *
+ * @param \Drupal\block\BlockInterface $block
+ * The block whose 'settings_tray' form is being accessed.
+ *
+ * @return \Drupal\Core\Access\AccessResultInterface
+ * The access result.
+ */
+ public function access(BlockInterface $block) {
+ return AccessResult::allowedIf(!_settings_tray_has_block_overrides($block));
+ }
+
+}