SearchContentBlock.php in Open Social 8.8
Same filename and directory in other branches
- 8.9 modules/social_features/social_search/src/Plugin/Block/SearchContentBlock.php
- 8 modules/social_features/social_search/src/Plugin/Block/SearchContentBlock.php
- 8.2 modules/social_features/social_search/src/Plugin/Block/SearchContentBlock.php
- 8.3 modules/social_features/social_search/src/Plugin/Block/SearchContentBlock.php
- 8.4 modules/social_features/social_search/src/Plugin/Block/SearchContentBlock.php
- 8.5 modules/social_features/social_search/src/Plugin/Block/SearchContentBlock.php
- 8.6 modules/social_features/social_search/src/Plugin/Block/SearchContentBlock.php
- 8.7 modules/social_features/social_search/src/Plugin/Block/SearchContentBlock.php
- 10.3.x modules/social_features/social_search/src/Plugin/Block/SearchContentBlock.php
- 10.0.x modules/social_features/social_search/src/Plugin/Block/SearchContentBlock.php
- 10.1.x modules/social_features/social_search/src/Plugin/Block/SearchContentBlock.php
- 10.2.x modules/social_features/social_search/src/Plugin/Block/SearchContentBlock.php
Namespace
Drupal\social_search\Plugin\BlockFile
modules/social_features/social_search/src/Plugin/Block/SearchContentBlock.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 'SearchContentBlock' block.
*
* @Block(
* id = "search_content_block",
* admin_label = @Translation("Search navbar block"),
* )
*/
class SearchContentBlock 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\\SearchContentForm');
$build['search_form'] = $form;
return $build;
}
}
Classes
Name | Description |
---|---|
SearchContentBlock | Provides a 'SearchContentBlock' block. |