Security update to Drupal 8.4.6
[yaffs-website] / web / core / modules / search / src / Plugin / Block / SearchBlock.php
1 <?php
2
3 namespace Drupal\search\Plugin\Block;
4
5 use Drupal\Core\Access\AccessResult;
6 use Drupal\Core\Session\AccountInterface;
7 use Drupal\Core\Block\BlockBase;
8
9 /**
10  * Provides a 'Search form' block.
11  *
12  * @Block(
13  *   id = "search_form_block",
14  *   admin_label = @Translation("Search form"),
15  *   category = @Translation("Forms")
16  * )
17  */
18 class SearchBlock extends BlockBase {
19
20   /**
21    * {@inheritdoc}
22    */
23   protected function blockAccess(AccountInterface $account) {
24     return AccessResult::allowedIfHasPermission($account, 'search content');
25   }
26
27   /**
28    * {@inheritdoc}
29    */
30   public function build() {
31     return \Drupal::formBuilder()->getForm('Drupal\search\Form\SearchBlockForm');
32   }
33
34 }