1.20.x 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
- modules/
views/ includes/ view.inc, line 2121 - Provides the view object type and associated methods.
Class
- view
- 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.
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;
}