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

Generate a display id of a certain plugin type.


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


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


An object to contain all of the data to generate a view, plus the member functions to build the view query, execute the query and render the output.


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;