Same name and namespace in other branches
  1. 6.x-3.x includes/view.inc \views_db_object::generate_display_id()

Generate a display id of a certain plugin type.

Parameters

string $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 2441
views_objects Objects that represent a View or part of a view

Class

views_db_object

Code

public 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;
}