You are here

public function Field::getSettings in Search API 8

Retrieves all settings encapsulated in this field as an array.

Return value

array An associative array of field settings.

Overrides FieldInterface::getSettings

File

src/Item/Field.php, line 299

Class

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

Namespace

Drupal\search_api\Item

Code

public function getSettings() {
  $settings = [
    'label' => $this
      ->getLabel(),
    'datasource_id' => $this
      ->getDatasourceId(),
    'property_path' => $this
      ->getPropertyPath(),
    'type' => $this
      ->getType(),
  ];
  if ($this
    ->getDatasourceId() === NULL) {
    unset($settings['datasource_id']);
  }
  if ($this
    ->getBoost() != 1.0) {
    $settings['boost'] = $this
      ->getBoost();
  }
  if ($this
    ->isIndexedLocked()) {
    $settings['indexed_locked'] = TRUE;
  }
  if ($this
    ->isTypeLocked()) {
    $settings['type_locked'] = TRUE;
  }
  if ($this
    ->isHidden()) {
    $settings['hidden'] = TRUE;
  }
  if ($this
    ->getConfiguration()) {
    $settings['configuration'] = $this
      ->getConfiguration();
  }
  if ($this
    ->getDependencies()) {
    $settings['dependencies'] = $this
      ->getDependencies();
  }
  return $settings;
}