Version 1
[yaffs-website] / web / core / modules / node / src / Plugin / Block / SyndicateBlock.php
1 <?php
2
3 namespace Drupal\node\Plugin\Block;
4
5 use Drupal\Core\Access\AccessResult;
6 use Drupal\Core\Block\BlockBase;
7 use Drupal\Core\Session\AccountInterface;
8
9 /**
10  * Provides a 'Syndicate' block that links to the site's RSS feed.
11  *
12  * @Block(
13  *   id = "node_syndicate_block",
14  *   admin_label = @Translation("Syndicate"),
15  *   category = @Translation("System")
16  * )
17  */
18 class SyndicateBlock extends BlockBase {
19
20   /**
21    * {@inheritdoc}
22    */
23   public function defaultConfiguration() {
24     return [
25       'block_count' => 10,
26     ];
27   }
28
29   /**
30    * {@inheritdoc}
31    */
32   protected function blockAccess(AccountInterface $account) {
33     return AccessResult::allowedIfHasPermission($account, 'access content');
34   }
35
36   /**
37    * {@inheritdoc}
38    */
39   public function build() {
40     return [
41       '#theme' => 'feed_icon',
42       '#url' => 'rss.xml',
43     ];
44   }
45
46 }