public function OtherView::getValueOptions in OtherView Filter 8
Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.
This can use a guard to be used to reduce database hits as much as possible.
Return value
array|null The stored values from $this->valueOptions.
Overrides InOperator::getValueOptions
File
- src/
Plugin/ views/ filter/ OtherView.php, line 123
Class
- OtherView
- Filter content by other view results set.
Namespace
Drupal\other_view_filter\Plugin\views\filterCode
public function getValueOptions() {
if (isset($this->valueOptions)) {
return $this->valueOptions;
}
$this->valueOptions = [];
$views = $this->viewStorage
->loadMultiple();
foreach ($views as $view) {
if ($view
->get('base_table') === $this->table && $view
->get('base_field') === $this->realField) {
foreach ($view
->get('display') as $display_id => $display) {
$this->valueOptions[$view
->id() . ':' . $display_id] = $view
->label() . ': ' . $display['display_title'];
}
}
}
return $this->valueOptions;
}