function ctools_edit_context_form in Chaos Tool Suite (ctools) 6
Form (for ajax use) to add a context
1 string reference to 'ctools_edit_context_form'
- ctools_context_info in includes/
context-admin.inc - Provide a list of the ways contexts can be embedded.
File
- includes/
context-admin.inc, line 583 - includes/common-context.inc Provide API for adding contexts for modules that embed displays.
Code
function ctools_edit_context_form(&$form_state) {
$object = $form_state['object'];
$context = $form_state['info'];
$position = $form_state['position'];
$contexts = $form_state['contexts'];
$ctext = $object->contexts[$position];
$form['description'] = array(
'#prefix' => '<div class="description">',
'#suffix' => '</div>',
'#value' => check_plain($context['description']),
);
// Basic context values
$form['context']['#tree'] = TRUE;
$form['context']['name'] = array(
'#type' => 'hidden',
'#value' => $context['name'],
);
$form['context']['id'] = array(
'#type' => 'hidden',
'#value' => $ctext['id'],
);
$form['context']['identifier'] = array(
'#type' => 'textfield',
'#title' => t('Identifier'),
'#description' => t('Enter a name to identify this !type on administrative screens.', array(
'!type' => t('context'),
)),
'#default_value' => $ctext['identifier'],
);
$form['context']['keyword'] = array(
'#type' => 'textfield',
'#title' => t('Keyword'),
'#description' => t('Enter a keyword to use for substitution in titles.'),
'#default_value' => $ctext['keyword'],
);
// Settings particular to this context
$context_settings = array();
if (isset($ctext['context_settings'])) {
$context_settings = $ctext['context_settings'];
}
if (isset($context['settings form']) && function_exists($context['settings form'])) {
$form['context']['context_settings'] = $context['settings form']($context_settings);
$form['context']['context_settings']['#tree'] = TRUE;
}
$form['next'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}