You are here

protected static function CallbackFieldRow::extractFromOptionsArray in Search Autocomplete 8

Same name and namespace in other branches
  1. 2.x src/Plugin/views/row/CallbackFieldRow.php \Drupal\search_autocomplete\Plugin\views\row\CallbackFieldRow::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 CallbackFieldRow::extractFromOptionsArray()
CallbackFieldRow::init in src/Plugin/views/row/CallbackFieldRow.php
Overrides \Drupal\views\Plugin\views\row\RowPluginBase::init().
CallbackFieldRow::validateOptionsForm in src/Plugin/views/row/CallbackFieldRow.php
Overrides \Drupal\views\Plugin\views\row\RowPluginBase::validateOptionsForm().

File

src/Plugin/views/row/CallbackFieldRow.php, line 72

Class

CallbackFieldRow
Plugin which displays fields as raw data.

Namespace

Drupal\search_autocomplete\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);
}