1 view.inc view::generate_display_id($type)

Generate a display id of a certain plugin type.

Parameters

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

File

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

Class

view

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