You are here

public function SearchApiAlterNodeStatus::supportsIndex in Search API 7

Check whether this data-alter callback is applicable for a certain index.

Returns TRUE only for indexes on nodes.

Parameters

SearchApiIndex $index: The index to check for.

Return value

boolean TRUE if the callback can run on the given index; FALSE otherwise.

Overrides SearchApiAbstractAlterCallback::supportsIndex

File

includes/callback_node_status.inc, line 24
Contains the SearchApiAlterNodeStatus class.

Class

SearchApiAlterNodeStatus
Exclude unpublished nodes from node indexes.

Code

public function supportsIndex(SearchApiIndex $index) {
  if ($this
    ->isMultiEntityIndex($index)) {
    return in_array('node', $index->options['datasource']['types']);
  }
  return $index
    ->getEntityType() === 'node';
}