SearchInterface
interface SearchInterface implements PluginInspectionInterface (View source)
Defines a common interface for all SearchPlugin objects.
Methods
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.
Returns the current parameters set using setSearch().
Returns the currently set attributes (from the request).
Verifies if the values set via setSearch() are valid and sufficient.
Returns the search index type this plugin uses.
Executes the search.
Executes the search and builds render arrays for the result items.
Provides a suggested title for a page of search results.
Returns the searching help.
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.
Details
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.