You are here

public function UnsavedIndexConfiguration::setFields in Search API 8

Sets this index's fields.

Usually, it's a better idea to add/rename/remove fields individually with the above methods. Use this method only if this is for some reason not easily possible (such as when renaming multiple fields at once might cause conflicts).

Parameters

\Drupal\search_api\Item\FieldInterface[] $fields: An array of fields for this index, keyed by field IDs.

Return value

$this

Overrides IndexInterface::setFields

File

src/UnsavedIndexConfiguration.php, line 469

Class

UnsavedIndexConfiguration
Represents a configuration of an index that was not yet permanently saved.

Namespace

Drupal\search_api

Code

public function setFields(array $fields) {
  $this->entity
    ->setFields($fields);
  return $this;
}