Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ConfigurableSearchPluginBase.php

class ConfigurableSearchPluginBase

Provides a base implementation for a configurable Search plugin.

Hierarchy

  • class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
    • class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
      • class \Drupal\search\Plugin\SearchPluginBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\search\Plugin\SearchInterface, \Drupal\Core\Cache\RefinableCacheableDependencyInterface uses \Drupal\Core\Cache\RefinableCacheableDependencyTrait
        • class \Drupal\search\Plugin\ConfigurableSearchPluginBase extends \Drupal\search\Plugin\SearchPluginBase implements \Drupal\search\Plugin\ConfigurableSearchPluginInterface

Expanded class hierarchy of ConfigurableSearchPluginBase

2 files declare their use of ConfigurableSearchPluginBase
EntitySearchPage.php in core/modules/search/src/Plugin/migrate/destination/EntitySearchPage.php
NodeSearch.php in core/modules/node/src/Plugin/Search/NodeSearch.php

File

core/modules/search/src/Plugin/ConfigurableSearchPluginBase.php, line 11

Namespace

Drupal\search\Plugin
View source
abstract class ConfigurableSearchPluginBase extends SearchPluginBase implements ConfigurableSearchPluginInterface {
    
    /**
     * The unique ID for the search page using this plugin.
     *
     * @var string
     */
    protected $searchPageId;
    
    /**
     * {@inheritdoc}
     */
    public function __construct(array $configuration, $plugin_id, $plugin_definition) {
        parent::__construct($configuration, $plugin_id, $plugin_definition);
        $this->setConfiguration($configuration);
    }
    
    /**
     * {@inheritdoc}
     */
    public function defaultConfiguration() {
        return [];
    }
    
    /**
     * {@inheritdoc}
     */
    public function getConfiguration() {
        return $this->configuration;
    }
    
    /**
     * {@inheritdoc}
     */
    public function setConfiguration(array $configuration) {
        $this->configuration = NestedArray::mergeDeep($this->defaultConfiguration(), $configuration);
    }
    
    /**
     * {@inheritdoc}
     */
    public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
    }
    
    /**
     * {@inheritdoc}
     */
    public function calculateDependencies() {
        return [];
    }
    
    /**
     * {@inheritdoc}
     */
    public function setSearchPageId($search_page_id) {
        $this->searchPageId = $search_page_id;
        return $this;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
CacheableDependencyTrait::$cacheContexts protected property Cache contexts.
CacheableDependencyTrait::$cacheMaxAge protected property Cache max-age.
CacheableDependencyTrait::$cacheTags protected property Cache tags.
CacheableDependencyTrait::getCacheContexts public function 4
CacheableDependencyTrait::getCacheMaxAge public function 4
CacheableDependencyTrait::getCacheTags public function 4
CacheableDependencyTrait::setCacheability protected function Sets cacheability; useful for value object constructors.
ConfigurableSearchPluginBase::$searchPageId protected property The unique ID for the search page using this plugin.
ConfigurableSearchPluginBase::calculateDependencies public function Calculates dependencies for the configured plugin. Overrides DependentPluginInterface::calculateDependencies
ConfigurableSearchPluginBase::defaultConfiguration public function Gets default configuration for this plugin. Overrides ConfigurableInterface::defaultConfiguration 1
ConfigurableSearchPluginBase::getConfiguration public function Gets this plugin's configuration. Overrides ConfigurableInterface::getConfiguration
ConfigurableSearchPluginBase::setConfiguration public function Sets the configuration for this plugin instance. Overrides ConfigurableInterface::setConfiguration
ConfigurableSearchPluginBase::setSearchPageId public function Sets the ID for the search page using this plugin. Overrides ConfigurableSearchPluginInterface::setSearchPageId
ConfigurableSearchPluginBase::validateConfigurationForm public function Form validation handler. Overrides PluginFormInterface::validateConfigurationForm
ConfigurableSearchPluginBase::__construct public function 1
PluginFormInterface::buildConfigurationForm public function Form constructor. 20
PluginFormInterface::submitConfigurationForm public function Form submission handler. 20
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 5
PluginInspectionInterface::getPluginId public function Gets the plugin ID of the plugin instance. 2
RefinableCacheableDependencyTrait::addCacheableDependency public function 1
RefinableCacheableDependencyTrait::addCacheContexts public function
RefinableCacheableDependencyTrait::addCacheTags public function
RefinableCacheableDependencyTrait::mergeCacheMaxAge public function
SearchInterface::execute public function Executes the search. 3
SearchPluginBase::$keywords protected property The keywords to use in a search.
SearchPluginBase::$searchAttributes protected property Array of attributes - usually from the request object.
SearchPluginBase::$searchParameters protected property Array of parameters from the query string from the request.
SearchPluginBase::buildResults public function Executes the search and builds render arrays for the result items. Overrides SearchInterface::buildResults
SearchPluginBase::buildSearchUrlQuery public function Builds the URL GET query parameters array for search. Overrides SearchInterface::buildSearchUrlQuery 1
SearchPluginBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create 3
SearchPluginBase::getAttributes public function Returns the currently set attributes (from the request). Overrides SearchInterface::getAttributes
SearchPluginBase::getHelp public function Returns the searching help. Overrides SearchInterface::getHelp 1
SearchPluginBase::getKeywords public function Returns the currently set keywords of the plugin instance. Overrides SearchInterface::getKeywords
SearchPluginBase::getParameters public function Returns the current parameters set using setSearch(). Overrides SearchInterface::getParameters
SearchPluginBase::getType public function Returns the search index type this plugin uses. Overrides SearchInterface::getType 2
SearchPluginBase::isSearchExecutable public function Verifies if the values set via setSearch() are valid and sufficient. Overrides SearchInterface::isSearchExecutable 1
SearchPluginBase::searchFormAlter public function Alters the search form when being built for a given plugin. Overrides SearchInterface::searchFormAlter 1
SearchPluginBase::setSearch public function Sets the keywords, parameters, and attributes to be used by execute(). Overrides SearchInterface::setSearch
SearchPluginBase::suggestedTitle public function Provides a suggested title for a page of search results. Overrides SearchInterface::suggestedTitle
SearchPluginBase::usesAdminTheme public function Returns whether or not search results should be displayed in admin theme. Overrides SearchInterface::usesAdminTheme

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal