You are here

public function UnsavedIndexConfiguration::renameField in Search API 8

Changes the field ID of a field.

Parameters

string $old_field_id: The old ID of the field.

string $new_field_id: The new ID of the field.

Return value

$this

Throws

\Drupal\search_api\SearchApiException Thrown if no field with the old ID exists, or because the new ID is already taken, or because the new field ID is one of the pseudo-fields that can be used in search queries.

Overrides IndexInterface::renameField

File

src/UnsavedIndexConfiguration.php, line 453

Class

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

Namespace

Drupal\search_api

Code

public function renameField($old_field_id, $new_field_id) {
  $this->entity
    ->renameField($old_field_id, $new_field_id);
  return $this;
}