You are here

protected function ViewsEmbedDialog::getViewsOptions in Views entity embed 8

Same name and namespace in other branches
  1. 2.0.x src/Form/ViewsEmbedDialog.php \Drupal\views_entity_embed\Form\ViewsEmbedDialog::getViewsOptions()

Get all Views as options.

2 calls to ViewsEmbedDialog::getViewsOptions()
ViewsEmbedDialog::buildSelectViewStep in src/Form/ViewsEmbedDialog.php
Form constructor for the entity selection step.
ViewsEmbedDialog::selectStepsOfForm in src/Form/ViewsEmbedDialog.php
Skip steps with only one options.

File

src/Form/ViewsEmbedDialog.php, line 167

Class

ViewsEmbedDialog
Provides a form to embed URLs.

Namespace

Drupal\views_entity_embed\Form

Code

protected function getViewsOptions($embed_button) {
  $views = [
    '' => $this
      ->t('Select View'),
  ];
  foreach (Views::getAllViews() as $view) {
    $views[$view
      ->id()] = $view
      ->label();
  }
  return $embed_button
    ->getTypeSetting('filter_views') ? array_intersect_key($views, $embed_button
    ->getTypeSetting('views_options')) : $views;
}