function ViewFormBase::isDefaultDisplayShown

Same name in other branches
  1. 9 core/modules/views_ui/src/ViewFormBase.php \Drupal\views_ui\ViewFormBase::isDefaultDisplayShown()
  2. 8.9.x core/modules/views_ui/src/ViewFormBase.php \Drupal\views_ui\ViewFormBase::isDefaultDisplayShown()
  3. 10 core/modules/views_ui/src/ViewFormBase.php \Drupal\views_ui\ViewFormBase::isDefaultDisplayShown()

Controls whether or not the default display should have its own tab on edit.

1 call to ViewFormBase::isDefaultDisplayShown()
ViewFormBase::getDisplayTabs in core/modules/views_ui/src/ViewFormBase.php
Adds tabs for navigating across Displays when editing a View.

File

core/modules/views_ui/src/ViewFormBase.php, line 146

Class

ViewFormBase
Base form for Views forms.

Namespace

Drupal\views_ui

Code

public function isDefaultDisplayShown(ViewUI $view) {
    // Always show the default display for advanced users who prefer that mode.
    $advanced_mode = \Drupal::config('views.settings')->get('ui.show.default_display');
    // For other users, show the default display only if there are no others, and
    // hide it if there's at least one "real" display.
    $additional_displays = count($view->getExecutable()->displayHandlers) == 1;
    return $advanced_mode || $additional_displays;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.