function 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 2455

Class

views_db_object
Base class for views' database objects.

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