public function ViewExecutable::newDisplay in Views (for Drupal 7) 8.3
Creates and stores a new display.
Parameters
string $id: The ID for the display being added.
Return value
Drupal\views\Plugin\views\display\DisplayPluginBase A reference to the new handler object.
File
- lib/
Drupal/ views/ ViewExecutable.php, line 2211 - 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\viewsCode
public function &newDisplay($id) {
// Create a handler.
$this->displayHandlers[$id] = views_get_plugin('display', $this->storage->display[$id]['display_plugin']);
if (empty($this->displayHandlers[$id])) {
// provide a 'default' handler as an emergency. This won't work well but
// it will keep things from crashing.
$this->displayHandlers[$id] = views_get_plugin('display', 'default');
}
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
if ($id != 'default') {
// @todo is the '&' still required in php5?
$this->displayHandlers[$id]->default_display =& $this->displayHandlers['default'];
}
}
return $this->displayHandlers[$id];
}