You are here

public function Index::getField in Search API 8

Returns a field from this index.

Parameters

string $field_id: The field identifier.

Return value

\Drupal\search_api\Item\FieldInterface|null The field with the given field identifier, or NULL if there is no such field.

Overrides IndexInterface::getField

2 calls to Index::getField()
Index::addField in src/Entity/Index.php
Adds a field to this index.
Index::removeField in src/Entity/Index.php
Removes a field from the index.

File

src/Entity/Index.php, line 774

Class

Index
Defines the search index configuration entity.

Namespace

Drupal\search_api\Entity

Code

public function getField($field_id) {
  $fields = $this
    ->getFields();
  return $fields[$field_id] ?? NULL;
}