You are here

protected function ViewsReferenceTrait::getAllViewsDisplayIds in Views Reference Field 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldWidget/ViewsReferenceTrait.php \Drupal\viewsreference\Plugin\Field\FieldWidget\ViewsReferenceTrait::getAllViewsDisplayIds()

Helper function to get all display ids.

File

src/Plugin/Field/FieldWidget/ViewsReferenceTrait.php, line 295

Class

ViewsReferenceTrait
Trait for shared code in Viewsreference Field Widgets.

Namespace

Drupal\viewsreference\Plugin\Field\FieldWidget

Code

protected function getAllViewsDisplayIds() {
  $views = Views::getAllViews();
  $options = [];
  foreach ($views as $view) {
    if ($displays = $view
      ->get('display')) {
      foreach ($displays as $display) {
        $options[$display['id']] = $display['display_title'];
      }
    }
  }
  return $options;
}