ConfigurableSearchPluginInterface
interface ConfigurableSearchPluginInterface implements ConfigurableInterface, DependentPluginInterface, PluginFormInterface, SearchInterface (View source)
Provides an interface for a configurable Search plugin.
Methods
Sets the configuration for this plugin instance.
Calculates dependencies for the configured plugin.
Gets the definition of the plugin implementation.
Sets the keywords, parameters, and attributes to be used by execute().
Returns the currently set keywords of the plugin instance.
Verifies if the values set via setSearch() are valid and sufficient.
Executes the search and builds render arrays for the result items.
Provides a suggested title for a page of search results.
Alters the search form when being built for a given plugin.
Builds the URL GET query parameters array for search.
Returns whether or not search results should be displayed in admin theme.
Sets the ID for the search page using this plugin.
Details
array
getConfiguration()
Gets this plugin's configuration.
setConfiguration(array $configuration)
Sets the configuration for this plugin instance.
array
defaultConfiguration()
Gets default configuration for this plugin.
array
calculateDependencies()
Calculates dependencies for the configured plugin.
Dependencies are saved in the plugin's configuration entity and are used to determine configuration synchronization order. For example, if the plugin integrates with specific user roles, this method should return an array of dependencies listing the specified roles.
array
buildConfigurationForm(array $form, FormStateInterface $form_state)
Form constructor.
Plugin forms are embedded in other forms. In order to know where the plugin form is located in the parent form, #parents and #array_parents must be known, but these are not available during the initial build phase. In order to have these properties available when building the plugin form's elements, let this method return a form element that has a #process callback and build the rest of the form in the callback. By the time the callback is executed, the element's #parents and #array_parents properties will have been set by the form API. For more documentation on #parents and
array_parents, see \Drupal\Core\Render\Element\FormElement.
validateConfigurationForm(array $form, FormStateInterface $form_state)
Form validation handler.
submitConfigurationForm(array $form, FormStateInterface $form_state)
Form submission handler.
string
getPluginId()
Gets the plugin_id of the plugin instance.
array
getPluginDefinition()
Gets the definition of the plugin implementation.
$this
setSearch(string $keywords, array $parameters, array $attributes)
Sets the keywords, parameters, and attributes to be used by execute().
string
getKeywords()
Returns the currently set keywords of the plugin instance.
array
getParameters()
Returns the current parameters set using setSearch().
array
getAttributes()
Returns the currently set attributes (from the request).
bool
isSearchExecutable()
Verifies if the values set via setSearch() are valid and sufficient.
string|null
getType()
Returns the search index type this plugin uses.
array
execute()
Executes the search.
array
buildResults()
Executes the search and builds render arrays for the result items.
string
suggestedTitle()
Provides a suggested title for a page of search results.
array
getHelp()
Returns the searching help.
searchFormAlter(array $form, FormStateInterface $form_state)
Alters the search form when being built for a given plugin.
The core search module only invokes this method on active module plugins when building a form for them in \Drupal\search\Form\SearchPageForm::buildForm(). A plugin implementing this will also need to implement the buildSearchUrlQuery() method.
array
buildSearchUrlQuery(FormStateInterface $form_state)
Builds the URL GET query parameters array for search.
When the search form is submitted, a redirect is generated with the search input as GET query parameters. Plugins using the searchFormAlter() method to add form elements to the search form will need to override this method to gather the form input and add it to the GET query parameters.
bool
usesAdminTheme()
Returns whether or not search results should be displayed in admin theme.
ConfigurableSearchPluginInterface
setSearchPageId(string $search_page_id)
Sets the ID for the search page using this plugin.