protected function ViewsReferenceTrait::getViewNames in Views Reference Field 8.2
Same name and namespace in other branches
- 8 src/Plugin/Field/FieldWidget/ViewsReferenceTrait.php \Drupal\viewsreference\Plugin\Field\FieldWidget\ViewsReferenceTrait::getViewNames()
Get view names for a list of view machine names.
Parameters
array $views_array: An array containing view machine names.
Return value
array An array with view labels keyed by machine name.
1 call to ViewsReferenceTrait::getViewNames()
- ViewsReferenceSelectWidget::formElement in src/
Plugin/ Field/ FieldWidget/ ViewsReferenceSelectWidget.php - Returns the form for a single field widget.
File
- src/
Plugin/ Field/ FieldWidget/ ViewsReferenceTrait.php, line 345
Class
- ViewsReferenceTrait
- Trait for shared code in Viewsreference Field Widgets.
Namespace
Drupal\viewsreference\Plugin\Field\FieldWidgetCode
protected function getViewNames(array $views_array) {
$views_list = [];
foreach ($views_array as $key => $value) {
if ($view = Views::getView($key)) {
$views_list[$view->storage
->id()] = $view->storage
->label();
}
}
return $views_list;
}