abstract class SearchApiAbstractAlterCallback in Search API 7
Abstract base class for data-alter callbacks.
This class implements most methods with sensible defaults.
Extending classes will at least have to implement the alterItems() method to make this work. If that method adds additional fields to the items, propertyInfo() has to be overridden, too.
Hierarchy
- class \SearchApiAbstractAlterCallback implements SearchApiAlterCallbackInterface
Expanded class hierarchy of SearchApiAbstractAlterCallback
File
- includes/
callback.inc, line 125 - Contains base definitions for data alterations.
View source
abstract class SearchApiAbstractAlterCallback implements SearchApiAlterCallbackInterface {
/**
* The index whose items will be altered.
*
* @var SearchApiIndex
*/
protected $index;
/**
* The configuration options for this callback, if it has any.
*
* @var array
*/
protected $options;
/**
* Implements SearchApiAlterCallbackInterface::__construct().
*/
public function __construct(SearchApiIndex $index, array $options = array()) {
$this->index = $index;
$this->options = $options;
}
/**
* Implements SearchApiAlterCallbackInterface::supportsIndex().
*
* The default implementation always returns TRUE.
*/
public function supportsIndex(SearchApiIndex $index) {
return TRUE;
}
/**
* Implements SearchApiAlterCallbackInterface::configurationForm().
*/
public function configurationForm() {
return array();
}
/**
* Implements SearchApiAlterCallbackInterface::configurationFormValidate().
*/
public function configurationFormValidate(array $form, array &$values, array &$form_state) {
}
/**
* Implements SearchApiAlterCallbackInterface::configurationFormSubmit().
*/
public function configurationFormSubmit(array $form, array &$values, array &$form_state) {
$this->options = $values;
return $values;
}
/**
* Implements SearchApiAlterCallbackInterface::propertyInfo().
*/
public function propertyInfo() {
return array();
}
/**
* Determines whether the given index contains multiple types of entities.
*
* @param SearchApiIndex|null $index
* (optional) The index to examine. Defaults to the index set for this
* plugin.
*
* @return bool
* TRUE if the index is a multi-entity index, FALSE otherwise.
*/
protected function isMultiEntityIndex(SearchApiIndex $index = NULL) {
$index = $index ? $index : $this->index;
return $index
->datasource() instanceof SearchApiCombinedEntityDataSourceController;
}
}