protected function Search::writeChangesToSettings in Search API Autocomplete 8
Prepares for changes to this search to be persisted.
To this end, the settings for all loaded plugin objects are written back to the corresponding *_settings properties.
Return value
$this
1 call to Search::writeChangesToSettings()
- Search::preSave in src/
Entity/ Search.php - Acts on an entity before the presave hook is invoked.
File
- src/
Entity/ Search.php, line 472
Class
- Search
- Describes the autocomplete settings for a certain search.
Namespace
Drupal\search_api_autocomplete\EntityCode
protected function writeChangesToSettings() {
// Write the enabled suggesters to the settings property.
$this->suggester_settings = [];
foreach ($this
->getSuggesters() as $suggester_id => $suggester) {
if ($suggester
->supportsSearch($this)) {
$configuration = $suggester
->getConfiguration();
$this->suggester_settings[$suggester_id] = $configuration;
}
else {
unset($this->suggesterInstances[$suggester_id]);
}
}
// Write the search plugin configuration to the settings property.
if ($this->searchPlugin !== NULL) {
$plugin_id = $this->searchPlugin
->getPluginId();
$this->search_settings = [
$plugin_id => $this->searchPlugin
->getConfiguration(),
];
}
return $this;
}