function context_node_form_alter in Context Node 7
Same name and namespace in other branches
- 6 context_node.module \context_node_form_alter()
Implements hook_form_alter()
File
- ./
context_node.module, line 18
Code
function context_node_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'node_type_form') {
$form['context'] = array(
'#type' => 'fieldset',
'#title' => t("Allowed node contexts"),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#group' => 'additional_settings',
'#weight' => 50,
);
$form['context']['context_node'] = array(
'#type' => 'checkboxes',
'#title' => t('Select allowed contents'),
'#options' => _context_node_get_contexts(),
'#description' => t('Select all contexts that will be available for this content type'),
);
if (variable_get('context_node_' . $form['#node_type']->type) != NULL) {
$form['context']['context_node']['#default_value'] = variable_get('context_node_' . $form['#node_type']->type);
}
$default = variable_get('context_node_default_' . $form['#node_type']->type, FALSE);
$form['context']['context_node_default'] = array(
'#type' => 'radios',
'#title' => t('Select the default context'),
'#default_value' => isset($default) ? $default : "none",
'#options' => _context_node_get_default_contexts(),
'#description' => t('Select the default context. If you select "Disabled" this functionality will be disabled for this content type. If you select "Default" the functionality will be enabled but no context will be enabled by default'),
);
}
}