function ViewEntityInterface::addDisplay

Same name in other branches
  1. 8.9.x core/modules/views/src/ViewEntityInterface.php \Drupal\views\ViewEntityInterface::addDisplay()
  2. 10 core/modules/views/src/ViewEntityInterface.php \Drupal\views\ViewEntityInterface::addDisplay()
  3. 11.x core/modules/views/src/ViewEntityInterface.php \Drupal\views\ViewEntityInterface::addDisplay()

Adds a new display handler to the view, automatically creating an ID.

Parameters

string $plugin_id: (optional) The plugin type from the Views plugin annotation. Defaults to 'page'.

string $title: (optional) The title of the display. Defaults to NULL.

string $id: (optional) The ID to use, e.g., 'default', 'page_1', 'block_2'. Defaults to NULL.

Return value

string|bool The key to the display in $view->display, or FALSE if no plugin ID was provided.

2 methods override ViewEntityInterface::addDisplay()
View::addDisplay in core/modules/views/src/Entity/View.php
Adds a new display handler to the view, automatically creating an ID.
ViewUI::addDisplay in core/modules/views_ui/src/ViewUI.php
Adds a new display handler to the view, automatically creating an ID.

File

core/modules/views/src/ViewEntityInterface.php, line 67

Class

ViewEntityInterface
Defines an interface for View storage classes.

Namespace

Drupal\views

Code

public function addDisplay($plugin_id = 'page', $title = NULL, $id = NULL);

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