class SearchPluginCollection
Same name in other branches
- 9 core/modules/search/src/Plugin/SearchPluginCollection.php \Drupal\search\Plugin\SearchPluginCollection
- 8.9.x core/modules/search/src/Plugin/SearchPluginCollection.php \Drupal\search\Plugin\SearchPluginCollection
- 10 core/modules/search/src/Plugin/SearchPluginCollection.php \Drupal\search\Plugin\SearchPluginCollection
Provides a container for lazily loading search plugins.
Hierarchy
- class \Drupal\Component\Plugin\LazyPluginCollection implements \Drupal\Component\Plugin\IteratorAggregate, \Drupal\Component\Plugin\Countable
- class \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection extends \Drupal\Component\Plugin\LazyPluginCollection uses \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\search\Plugin\SearchPluginCollection extends \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection
- class \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection extends \Drupal\Component\Plugin\LazyPluginCollection uses \Drupal\Core\DependencyInjection\DependencySerializationTrait
Expanded class hierarchy of SearchPluginCollection
2 files declare their use of SearchPluginCollection
- SearchPage.php in core/
modules/ search/ src/ Entity/ SearchPage.php - SearchPluginCollectionTest.php in core/
modules/ search/ tests/ src/ Unit/ SearchPluginCollectionTest.php
File
-
core/
modules/ search/ src/ Plugin/ SearchPluginCollection.php, line 11
Namespace
Drupal\search\PluginView source
class SearchPluginCollection extends DefaultSingleLazyPluginCollection {
/**
* The unique ID for the search page using this plugin collection.
*
* @var string
*/
protected $searchPageId;
/**
* Constructs a new SearchPluginCollection.
*
* @param \Drupal\Component\Plugin\PluginManagerInterface $manager
* The manager to be used for instantiating plugins.
* @param string $instance_id
* The ID of the plugin instance.
* @param array $configuration
* An array of configuration.
* @param string $search_page_id
* The unique ID of the search page using this plugin.
*/
public function __construct(PluginManagerInterface $manager, $instance_id, array $configuration, $search_page_id) {
parent::__construct($manager, $instance_id, $configuration);
$this->searchPageId = $search_page_id;
}
/**
* {@inheritdoc}
*
* @return \Drupal\search\Plugin\SearchInterface
*/
public function &get($instance_id) {
return parent::get($instance_id);
}
/**
* {@inheritdoc}
*/
protected function initializePlugin($instance_id) {
parent::initializePlugin($instance_id);
$plugin_instance = $this->pluginInstances[$instance_id];
if ($plugin_instance instanceof ConfigurableSearchPluginInterface) {
$plugin_instance->setSearchPageId($this->searchPageId);
}
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.