function context_field_field_instance_settings_form in Context Field 7
Implements hook_field_instance_settings_form().
File
- ./
context_field.module, line 130 - Context Field
Code
function context_field_field_instance_settings_form($field, $instance) {
$settings = $instance['settings'];
$options = array();
foreach (module_implements("block_info") as $module) {
foreach (module_invoke($module, "block_info") as $block) {
$block = (object) $block;
$group = isset($block->context_group) ? $block->context_group : $module;
$options[$group] = check_plain($group);
}
}
$form['allowed_blocks'] = array(
'#type' => 'checkboxes',
'#title' => t('Allowed Block Groups'),
'#options' => $options,
'#description' => t('Use this field to limit the kinds of blocks that can be added to the context through the UI'),
'#default_value' => isset($settings['allowed_blocks']) ? $settings['allowed_blocks'] : array(),
);
$contexts = context_load();
foreach ($contexts as $key => $context) {
if (isset($context->conditions['context_field']['values'][2])) {
$context_options[$key] = $context->description ? $context->description : $key;
}
}
$form['default_context'] = array(
'#type' => 'select',
'#title' => t('Defaut Context'),
'#options' => $context_options,
'#default_value' => isset($settings['default_context']) ? $settings['default_context'] : '',
);
$form['use_default'] = array(
'#type' => 'radios',
'#title' => t('Default Context Use'),
'#options' => array(
0 => t("Clone Default context on Entity Creation"),
1 => t("Always use Default Context"),
),
'#default_value' => isset($settings['use_default']) ? $settings['use_default'] : 0,
);
return $form;
}