function ctools_context_next_id in Chaos Tool Suite (ctools) 6
Same name and namespace in other branches
- 7 includes/context.inc \ctools_context_next_id()
Get the next id available given a list of already existing objects.
This finds the next id available for the named object.
Parameters
$objects: A list of context descriptor objects, i.e, arguments, relationships, contexts, etc.
$name: The name being used.
2 calls to ctools_context_next_id()
- ctools_context_ajax_item_add in includes/
context-admin.inc - Ajax entry point to add an context
- page_manager_page_argument_form_change_submit in page_manager/
plugins/ tasks/ page.admin.inc - Submit handler to change an argument.
File
- includes/
context.inc, line 677 - Contains code related to the ctools system of 'context'.
Code
function ctools_context_next_id($objects, $name) {
$id = 0;
// Figure out which instance of this argument we're creating
if (!$objects) {
return $id + 1;
}
foreach ($objects as $object) {
if (isset($object['name']) && $object['name'] == $name) {
if ($object['id'] > $id) {
$id = $object['id'];
}
}
}
return $id + 1;
}