You are here

function views_db_object::generate_display_id in Views (for Drupal 7) 6.2

Same name and namespace in other branches
  1. 6.3 includes/view.inc \views_db_object::generate_display_id()
  2. 7.3 includes/view.inc \views_db_object::generate_display_id()

Generate a display id of a certain plugin type.

Parameters

$type: Which plugin should be used for the new display id.

1 call to views_db_object::generate_display_id()
views_db_object::add_display in includes/view.inc
Add a new display handler to the view, automatically creating an id.

File

includes/view.inc, line 1894
view.inc Provides the view object type and associated methods.

Class

views_db_object
Base class for views' database objects.

Code

function generate_display_id($type) {

  // 'default' is singular and is unique, so just go with 'default'
  // for it. For all others, start counting.
  if ($type == 'default') {
    return 'default';
  }

  // Initial id.
  $id = $type . '_1';
  $count = 1;

  // Loop through IDs based upon our style plugin name until
  // we find one that is unused.
  while (!empty($this->display[$id])) {
    $id = $type . '_' . ++$count;
  }
  return $id;
}