You are here

public function Field::getDescription in Search API 8

Retrieves this field's description.

Return value

string|null A human-readable description for this field, or NULL if the field has no description.

Overrides FieldInterface::getDescription

File

src/Item/Field.php, line 398

Class

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

Namespace

Drupal\search_api\Item

Code

public function getDescription() {
  if (!isset($this->description)) {
    try {
      $property = $this
        ->getDataDefinition();
      if ($property instanceof ConfigurablePropertyInterface) {
        $this->description = $property
          ->getFieldDescription($this);
      }
      else {
        $this->description = $property
          ->getDescription();
      }
      $this->description = $this->description ?: FALSE;
    } catch (SearchApiException $e) {
      $this
        ->logException($e);
    }
  }
  return $this->description ?: NULL;
}