You are here

function search_api_exclude_entity_base_field_info in Search API exclude 8

Implements hook_entity_base_field_info().

File

./search_api_exclude.module, line 96
Allows users to exclude specific nodes from indexing by Search API.

Code

function search_api_exclude_entity_base_field_info(EntityTypeInterface $entity_type) {
  $fields = [];
  if ($entity_type
    ->id() === 'node') {
    $fields['sae_exclude'] = BaseFieldDefinition::create('boolean')
      ->setLabel(t('Search API Exclude'))
      ->setDescription(t('Specify whether the node may be indexed or not.'));
  }
  return $fields;
}