Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ViewExecutable.php

function ViewExecutable::newDisplay

Creates a new display and a display handler instance for it.

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

\Drupal\views\Plugin\views\display\DisplayPluginBase A new display plugin instance if executable is set, the new display ID otherwise.

File

core/modules/views/src/ViewExecutable.php, line 903

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

public function newDisplay($plugin_id = 'page', $title = NULL, $id = NULL) {
    $this->initDisplay();
    $id = $this->storage
        ->addDisplay($plugin_id, $title, $id);
    $this->displayHandlers
        ->addInstanceId($id);
    $display = $this->displayHandlers
        ->get($id);
    $display->newDisplay();
    return $display;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal