function ctools_context_handler_edit_criteria in Chaos Tool Suite (ctools) 7
Same name and namespace in other branches
- 6 includes/context-task-handler.inc \ctools_context_handler_edit_criteria()
Form to choose context based selection rules for a task handler.
The configuration will be assumed to go simply in $handler->conf and will be keyed by the argument ID.
1 string reference to 'ctools_context_handler_edit_criteria'
- http_response.inc in page_manager/
plugins/ task_handlers/ http_response.inc - This is the task handler plugin to handle generating 403, 404, 301 and 302 response codes.
File
- includes/
context-task-handler.inc, line 460 - Support for creating 'context' type task handlers.
Code
function ctools_context_handler_edit_criteria($form, &$form_state) {
if (!isset($form_state['handler']->conf['access'])) {
$form_state['handler']->conf['access'] = array();
}
ctools_include('context');
ctools_include('modal');
ctools_include('ajax');
ctools_modal_add_plugin_js(ctools_get_access_plugins());
ctools_include('context-access-admin');
$form_state['module'] = isset($form_state['module']) ? $form_state['module'] : 'page_manager_task_handler';
// Encode a bunch of info into the argument so we can get our cache later.
$form_state['callback argument'] = $form_state['task_name'] . '*' . $form_state['handler']->name;
$form_state['access'] = $form_state['handler']->conf['access'];
$form_state['no buttons'] = TRUE;
$form_state['contexts'] = ctools_context_handler_get_all_contexts($form_state['task'], $form_state['subtask'], $form_state['handler']);
$form['markup'] = array(
'#markup' => '<div class="description">' . t('If there is more than one variant on a page, when the page is visited each variant is given an opportunity to be displayed. Starting from the first variant and working to the last, each one tests to see if its selection rules will pass. The first variant that meets its criteria (as specified below) will be used.') . '</div>',
);
$form = ctools_access_admin_form($form, $form_state);
return $form;
}