You are here

public function Field::addValue in Search API 8

Adds a value to this field.

Will take care of processing the value correctly with this field's data type plugin.

Parameters

mixed $value: A value to add to this field, not yet processed by the data type plugin.

Return value

$this

Overrides FieldInterface::addValue

File

src/Item/Field.php, line 554

Class

Field
Represents a field on a search item that can be indexed.

Namespace

Drupal\search_api\Item

Code

public function addValue($value) {

  // The data type has to be able to alter the given value before it is
  // included.
  $data_type_plugin = $this
    ->getDataTypePlugin();
  if ($data_type_plugin) {
    $value = $data_type_plugin
      ->getValue($value);
  }
  $this->values[] = $value;
  return $this;
}