You are here

protected function ViewsReferenceTrait::getAllViewsDisplayIds in Views Reference Field 8

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

Helper function to get all display ids.

1 call to ViewsReferenceTrait::getAllViewsDisplayIds()
ViewsReferenceTrait::fieldElement in src/Plugin/Field/FieldWidget/ViewsReferenceTrait.php
Build the field element.

File

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

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) {
    foreach ($view
      ->get('display') as $display) {
      $options[$display['id']] = $display['display_title'];
    }
  }
  return $options;
}