function panels_context_selector in Panels 5.2
Same name and namespace in other branches
- 6.2 includes/plugins.inc \panels_context_selector()
Create a select box to choose possible contexts. This only creates a selector if there is actually a choice.
Parameters
$contexts: A keyed array of all available contexts.
$required: The required context string or array.
Return value
A form element, or NULL if there are no contexts that satisfy the requirements.
2 calls to panels_context_selector()
- panels_common_edit_relationship_form in includes/
common.inc - Form (for ajax use) to add a relationship
- panels_ct_conf_form in includes/
plugins.inc - Add the default FAPI elements to the content type configuration form
File
- includes/
plugins.inc, line 997 - plugins.inc
Code
function panels_context_selector($contexts, $required, $default) {
if (is_array($required)) {
$result = array();
$count = 1;
foreach ($required as $id => $r) {
$result[] = _panels_context_selector($contexts, $r, $default[$id], $count++);
}
return $result;
}
return _panels_context_selector($contexts, $required, $default);
}