You are here

protected function ViewsEmbedDialog::getViewDisplays 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::getViewDisplays()

Get all displays of View.

2 calls to ViewsEmbedDialog::getViewDisplays()
ViewsEmbedDialog::buildSelectDisplay in src/Form/ViewsEmbedDialog.php
Form constructor for the view Select display.
ViewsEmbedDialog::selectStepsOfForm in src/Form/ViewsEmbedDialog.php
Skip steps with only one options.

File

src/Form/ViewsEmbedDialog.php, line 322

Class

ViewsEmbedDialog
Provides a form to embed URLs.

Namespace

Drupal\views_entity_embed\Form

Code

protected function getViewDisplays($view, $embed_button) {
  $display_options = $embed_button
    ->getTypeSetting('display_options');
  $filter_displays = $embed_button
    ->getTypeSetting('filter_displays');
  $displays = [];
  foreach ($view->displayHandlers as $id => $display) {
    if ($display
      ->isEnabled()) {
      if (!$filter_displays) {
        $displays[$id] = $display->display['display_title'];
      }
      elseif (!empty($display_options[get_class($display)])) {
        $displays[$id] = $display->display['display_title'];
      }
    }
  }
  return $displays;
}