function ctools_context_create_string in Chaos Tool Suite (ctools) 7
Same name and namespace in other branches
- 6 plugins/contexts/string.inc \ctools_context_create_string()
It's important to remember that $conf is optional here, because contexts are not always created from the UI.
1 string reference to 'ctools_context_create_string'
- string.inc in plugins/
contexts/ string.inc - Plugin to provide a string context.
File
- plugins/
contexts/ string.inc, line 37 - Plugin to provide a string context.
Code
function ctools_context_create_string($empty, $data = NULL, $conf = FALSE) {
// The input is expected to be an object as created by ctools_break_phrase
// which contains a group of string.
$context = new ctools_context('string');
$context->plugin = 'string';
if ($empty) {
return $context;
}
if ($data !== FALSE) {
// Support the array storage from the settings form but also handle direct input from arguments.
$context->data = is_array($data) ? $data['string'] : $data;
$context->title = $conf ? check_plain($data['identifier']) : check_plain($data);
return $context;
}
}