You are here

public function XmlFieldHelperTrait::getItems in Views XML Backend 8

Gets an array of items for the field.

Parameters

\Drupal\views\ResultRow $row: The result row object containing the values.

Return value

array An array of items for the field.

See also

\Drupal\views\Plugin\views\field\MultiItemsFieldHandlerInterface

File

src/Plugin/views/field/XmlFieldHelperTrait.php, line 141
Contains \Drupal\views_xml_backend\Plugin\views\field\XmlFieldHelperTrait.

Class

XmlFieldHelperTrait
A handler to provide an XML text field.

Namespace

Drupal\views_xml_backend\Plugin\views\field

Code

public function getItems(ResultRow $row) {
  $return = [];
  if ($values = $this
    ->getValue($row)) {
    foreach ($values as $value) {
      $return[] = [
        'value' => $value,
      ];
    }
  }
  return $return;
}