You are here

protected static function DataFieldRow::extractFromOptionsArray in Drupal 10

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()
  2. 9 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
DataFieldRow::validateOptionsForm in core/modules/rest/src/Plugin/views/row/DataFieldRow.php

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 $item[$key] ?? NULL;
  }, $options);
}