function views_db_object::new_display

nittany7 view.inc &views_db_object::new_display($type = 'page', $title = NULL, $id = NULL)
cis7 view.inc &views_db_object::new_display($type = 'page', $title = NULL, $id = NULL)
mooc7 view.inc &views_db_object::new_display($type = 'page', $title = NULL, $id = NULL)

Create a new display and a display handler for it.

Parameters

$type: The plugin type from the views plugin data. Defaults to 'page'.

$title: The title of the display; optional, may be filled in from default.

$id: The id to use.

Return value

views_plugin_display A reference to the new handler object.

File

modules/contrib/views/includes/view.inc, line 2418
Provides the view object type and associated methods.

Class

views_db_object
Base class for views' database objects.

Code

function &new_display($type = 'page', $title = NULL, $id = NULL) {
  $id = $this->add_display($type, $title, $id);

  // Create a handler
  $this->display[$id]->handler = views_get_plugin('display', $this->display[$id]->display_plugin);
  if (empty($this->display[$id]->handler)) {
    // provide a 'default' handler as an emergency. This won't work well but
    // it will keep things from crashing.
    $this->display[$id]->handler = views_get_plugin('display', 'default');
  }

  if (!empty($this->display[$id]->handler)) {
    // Initialize the new display handler with data.
    $this->display[$id]->handler->init($this, $this->display[$id]);
    // If this is NOT the default display handler, let it know which is
    if ($id != 'default') {
      $this->display[$id]->handler->default_display = &$this->display['default']->handler;
    }
  }

  return $this->display[$id]->handler;
}