You are here

public function TableValue::getValue in TableField 8.2

Gets the data value.

Return value

mixed The data value.

Overrides TypedData::getValue

File

src/TableValue.php, line 15

Class

TableValue
A computed property for Search API indexing.

Namespace

Drupal\tablefield

Code

public function getValue() {

  /** @var \Drupal\tablefield\Plugin\Field\FieldType\TablefieldItem $item */
  $item = $this
    ->getParent();
  $value = '';
  if (isset($item->value)) {
    foreach ($item->value as $row) {
      if (is_array($row)) {
        $value .= implode(' ', $row) . ' ';
      }
      elseif (is_string($row)) {
        $value .= ' ' . $row . ' ';
      }
    }
    $value = trim($value);
  }
  return $value;
}