function ctools_context_id in Chaos Tool Suite (ctools) 7
Same name and namespace in other branches
- 6 includes/context.inc \ctools_context_id()
Determine a unique context ID for a context.
Often contexts of many different types will be placed into a list. This ensures that even though contexts of multiple types may share IDs, they are unique in the final list.
7 calls to ctools_context_id()
- CtoolsContextIDTestCase::testContextId in tests/
context.test - Test ctools_context_id where the context only has an id.
- CtoolsContextIDTestCase::testContextIdName in tests/
context.test - Test ctools_context_id where the context has an id and a name.
- CtoolsContextIDTestCase::testContextIdNameType in tests/
context.test - Test ctools_context_id where the context has an id & name, and a type is specified.
- ctools_context_get_context_from_argument in includes/
context.inc - Get a context from an argument.
- ctools_context_get_context_from_arguments in includes/
context.inc - Load the contexts for a given list of arguments.
File
- includes/
context.inc, line 1083 - Contains code related to the ctools system of 'context'.
Code
function ctools_context_id($context, $type = 'context') {
// If not set, FALSE or empty.
if (!isset($context['id']) || !$context['id']) {
$context['id'] = 1;
}
// @todo is '' the appropriate default value?
$name = isset($context['name']) ? $context['name'] : '';
return $type . '_' . $name . '_' . $context['id'];
}