function ctools_context_required::select in Chaos Tool Suite (ctools) 6
Same name and namespace in other branches
- 7 includes/context.inc \ctools_context_required::select()
1 call to ctools_context_required::select()
- ctools_context_optional::select in includes/context.inc
1 method overrides ctools_context_required::select()
- ctools_context_optional::select in includes/context.inc
File
- includes/context.inc, line 159
- Contains code related to the ctools system of 'context'.
Class
- ctools_context_required
- Used to create a method of comparing if a list of contexts
match a required context type.
Code
function select($contexts, $context) {
if (!is_array($contexts)) {
$contexts = array(
$contexts,
);
}
if (!empty($context) && $context[strlen($context) - 1] === '0') {
$context[strlen($context) - 1] = 1;
}
if (empty($context) || empty($contexts[$context])) {
return FALSE;
}
return $contexts[$context];
}