Mercurial > hg > isophonics-drupal-site
view core/modules/search/src/Plugin/Block/SearchBlock.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line source
<?php namespace Drupal\search\Plugin\Block; use Drupal\Core\Access\AccessResult; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Block\BlockBase; /** * Provides a 'Search form' block. * * @Block( * id = "search_form_block", * admin_label = @Translation("Search form"), * category = @Translation("Forms") * ) */ class SearchBlock extends BlockBase { /** * {@inheritdoc} */ protected function blockAccess(AccountInterface $account) { return AccessResult::allowedIfHasPermission($account, 'search content'); } /** * {@inheritdoc} */ public function build() { return \Drupal::formBuilder()->getForm('Drupal\search\Form\SearchBlockForm'); } }