You are here

public function ViewExecutable::initDisplay in Views (for Drupal 7) 8.3

Set the display for this view and initialize the display handler.

6 calls to ViewExecutable::initDisplay()
ViewExecutable::access in lib/Drupal/views/ViewExecutable.php
Determine if the given user has access to the view. Note that this sets the display handler if it hasn't been.
ViewExecutable::buildTitle in lib/Drupal/views/ViewExecutable.php
Force the view to build a title.
ViewExecutable::chooseDisplay in lib/Drupal/views/ViewExecutable.php
Get the first display that is accessible to the user.
ViewExecutable::initHandlers in lib/Drupal/views/ViewExecutable.php
Acquire and attach all of the handlers.
ViewExecutable::setDisplay in lib/Drupal/views/ViewExecutable.php
Set the display as current.

... See full list

File

lib/Drupal/views/ViewExecutable.php, line 572
Definition of Drupal\views\ViewExecutable.

Class

ViewExecutable
An object to contain all of the data to generate a view, plus the member functions to build the view query, execute the query and render the output.

Namespace

Drupal\views

Code

public function initDisplay() {
  if (isset($this->current_display)) {
    return TRUE;
  }

  // Instantiate all displays
  foreach (array_keys($this->storage->display) as $id) {
    $this->displayHandlers[$id] = views_get_plugin('display', $this->storage->display[$id]['display_plugin']);
    if (!empty($this->displayHandlers[$id])) {

      // Initialize the new display handler with data.
      $this->displayHandlers[$id]
        ->init($this, $this->storage->display[$id]);

      // If this is NOT the default display handler, let it know which is
      // since it may well utilize some data from the default.
      // This assumes that the 'default' handler is always first. It always
      // is. Make sure of it.
      if ($id != 'default') {
        $this->displayHandlers[$id]->default_display =& $this->displayHandlers['default'];
      }
    }
  }
  $this->current_display = 'default';
  $this->display_handler = $this->displayHandlers['default'];
  return TRUE;
}