function views_db_object::generate_display_id
3.x view.inc | views_db_object::generate_display_id($type) |
2.x view.inc | views_db_object::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.
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
Class
- views_db_object
- Base class for views' database objects.
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;
}