You are here

protected static function DataFieldRow::extractFromOptionsArray in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/rest/src/Plugin/views/row/DataFieldRow.php \Drupal\rest\Plugin\views\row\DataFieldRow::extractFromOptionsArray()

Extracts a set of option values from a nested options array.

Parameters

string $key: The key to extract from each array item.

array $options: The options array to return values from.

Return value

array A regular one dimensional array of values.

2 calls to DataFieldRow::extractFromOptionsArray()
DataFieldRow::init in core/modules/rest/src/Plugin/views/row/DataFieldRow.php
Initialize the plugin.
DataFieldRow::validateOptionsForm in core/modules/rest/src/Plugin/views/row/DataFieldRow.php
Validate the options form.

File

core/modules/rest/src/Plugin/views/row/DataFieldRow.php, line 190

Class

DataFieldRow
Plugin which displays fields as raw data.

Namespace

Drupal\rest\Plugin\views\row

Code

protected static function extractFromOptionsArray($key, $options) {
  return array_map(function ($item) use ($key) {
    return isset($item[$key]) ? $item[$key] : NULL;
  }, $options);
}