Version 1
[yaffs-website] / web / core / modules / shortcut / src / Plugin / Block / ShortcutsBlock.php
diff --git a/web/core/modules/shortcut/src/Plugin/Block/ShortcutsBlock.php b/web/core/modules/shortcut/src/Plugin/Block/ShortcutsBlock.php
new file mode 100644 (file)
index 0000000..ab2d57e
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+
+namespace Drupal\shortcut\Plugin\Block;
+
+use Drupal\Core\Access\AccessResult;
+use Drupal\Core\Block\BlockBase;
+use Drupal\Core\Session\AccountInterface;
+
+/**
+ * Provides a 'Shortcut' block.
+ *
+ * @Block(
+ *   id = "shortcuts",
+ *   admin_label = @Translation("Shortcuts"),
+ *   category = @Translation("Menus")
+ * )
+ */
+class ShortcutsBlock extends BlockBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function build() {
+    return [
+      shortcut_renderable_links(shortcut_current_displayed_set()),
+    ];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function blockAccess(AccountInterface $account) {
+    return AccessResult::allowedIfHasPermission($account, 'access shortcuts');
+  }
+
+}