Set the display for this view and initialize the display handler.
public function initDisplay() {
if (isset($this->current_display)) {
return TRUE;
}
// Instantiate all displays
foreach ($this->storage
->get('display') as $id => $display) {
$this->displayHandlers[$id] = drupal_container()
->get("plugin.manager.views.display")
->createInstance($display['display_plugin']);
if (!empty($this->displayHandlers[$id])) {
// Initialize the new display handler with data.
// @todo Refactor display to not need the handler data by reference.
$this->displayHandlers[$id]
->init($this, $this->storage
->getDisplay($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;
}