SearchHeroBlock.php in Open Social 8.7
Same filename and directory in other branches
- 8.9 modules/social_features/social_search/src/Plugin/Block/SearchHeroBlock.php
- 8 modules/social_features/social_search/src/Plugin/Block/SearchHeroBlock.php
- 8.2 modules/social_features/social_search/src/Plugin/Block/SearchHeroBlock.php
- 8.3 modules/social_features/social_search/src/Plugin/Block/SearchHeroBlock.php
- 8.4 modules/social_features/social_search/src/Plugin/Block/SearchHeroBlock.php
- 8.5 modules/social_features/social_search/src/Plugin/Block/SearchHeroBlock.php
- 8.6 modules/social_features/social_search/src/Plugin/Block/SearchHeroBlock.php
- 8.8 modules/social_features/social_search/src/Plugin/Block/SearchHeroBlock.php
- 10.3.x modules/social_features/social_search/src/Plugin/Block/SearchHeroBlock.php
- 10.0.x modules/social_features/social_search/src/Plugin/Block/SearchHeroBlock.php
- 10.1.x modules/social_features/social_search/src/Plugin/Block/SearchHeroBlock.php
- 10.2.x modules/social_features/social_search/src/Plugin/Block/SearchHeroBlock.php
Namespace
Drupal\social_search\Plugin\BlockFile
modules/social_features/social_search/src/Plugin/Block/SearchHeroBlock.phpView source
<?php
namespace Drupal\social_search\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormBuilderInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides a 'SearchHeroBlock' block.
*
* @Block(
* id = "search_hero_block",
* admin_label = @Translation("Search hero block"),
* )
*/
class SearchHeroBlock extends BlockBase implements ContainerFactoryPluginInterface {
/**
* The form builder.
*
* @var \Drupal\Core\Form\FormBuilderInterface
*/
protected $formBuilder;
/**
* SearchHeroBlock constructor.
*
* @param array $configuration
* The given configuration.
* @param string $plugin_id
* The plugin id.
* @param mixed $plugin_definition
* The plugin definition.
* @param \Drupal\Core\Form\FormBuilderInterface $formBuilder
* The form builder.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, FormBuilderInterface $formBuilder) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->formBuilder = $formBuilder;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('form_builder'));
}
/**
* {@inheritdoc}
*/
public function build() {
$build = [];
$form = $this->formBuilder
->getForm('Drupal\\social_search\\Form\\SearchHeroForm');
$build['search_form'] = $form;
return $build;
}
}
Classes
Name | Description |
---|---|
SearchHeroBlock | Provides a 'SearchHeroBlock' block. |