class PageDeriver in Search API Autocomplete 8
Derives a search plugin definition for every view.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\search_api_autocomplete\Search\SearchPluginDeriverBase implements ContainerDeriverInterface uses StringTranslationTrait
- class \Drupal\search_api_autocomplete\Plugin\search_api_autocomplete\search\PageDeriver
- class \Drupal\search_api_autocomplete\Search\SearchPluginDeriverBase implements ContainerDeriverInterface uses StringTranslationTrait
Expanded class hierarchy of PageDeriver
See also
\Drupal\search_api_autocomplete\Plugin\search_api_autocomplete\search\Page
File
- src/
Plugin/ search_api_autocomplete/ search/ PageDeriver.php, line 13
Namespace
Drupal\search_api_autocomplete\Plugin\search_api_autocomplete\searchView source
class PageDeriver extends SearchPluginDeriverBase {
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
if (!isset($this->derivatives)) {
$this->derivatives = [];
try {
$page_storage = $this
->getEntityTypeManager()
->getStorage('search_api_page');
$index_storage = $this
->getEntityTypeManager()
->getStorage('search_api_index');
} catch (PluginException $e) {
return $this->derivatives;
}
/** @var \Drupal\search_api_page\SearchApiPageInterface $page */
foreach ($page_storage
->loadMultiple() as $page) {
$index = $index_storage
->load($page
->getIndex());
$this->derivatives[$page
->id()] = [
'label' => $page
->label(),
'index' => $index
->id(),
] + $base_plugin_definition;
}
}
return $this->derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
PageDeriver:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
SearchPluginDeriverBase:: |
protected | property |
List of derivative definitions. Overrides DeriverBase:: |
|
SearchPluginDeriverBase:: |
protected | property | The entity manager. | |
SearchPluginDeriverBase:: |
protected static | property | Existing instances of this class. | |
SearchPluginDeriverBase:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
SearchPluginDeriverBase:: |
public | function | Retrieves the entity manager. | |
SearchPluginDeriverBase:: |
public static | function | Resets the statically cached derivatives for all instances of this class. | |
SearchPluginDeriverBase:: |
public | function | Sets the entity manager. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |