function simplecontext_arg_context in Chaos Tool Suite (ctools) 6
Same name and namespace in other branches
- 7 ctools_plugin_example/plugins/arguments/simplecontext_arg.inc \simplecontext_arg_context()
Get the simplecontext context using the arg. In this case we're just going to manufacture the context from the data in the arg, but normally it would be an API call, db lookup, etc.
1 string reference to 'simplecontext_arg_context'
- simplecontext_arg.inc in ctools_plugin_example/
plugins/ arguments/ simplecontext_arg.inc - Sample plugin to provide an argument handler for a simplecontext.
File
- ctools_plugin_example/
plugins/ arguments/ simplecontext_arg.inc, line 40 - Sample plugin to provide an argument handler for a simplecontext.
Code
function simplecontext_arg_context($arg = NULL, $conf = NULL, $empty = FALSE) {
// If $empty == TRUE it wants a generic, unfilled context.
if ($empty) {
return ctools_context_create_empty('simplecontext');
}
// Do whatever error checking is required, returning FALSE if it fails the test
// Normally you'd check
// for a missing object, one you couldn't create, etc.
if (empty($arg)) {
return FALSE;
}
return ctools_context_create('simplecontext', $arg);
}