function fieldblock_form_field_ui_display_overview_form_alter in Field as Block 7
Same name and namespace in other branches
- 8 fieldblock.module \fieldblock_form_field_ui_display_overview_form_alter()
Implements hook_form_alter(). Adds a column to the "display fields" table-form, with a checkbox for each field.
File
- ./
fieldblock.module, line 35 - Allow fields to be rendered in blocks.
Code
function fieldblock_form_field_ui_display_overview_form_alter(&$form, &$form_state, $form_id) {
$entity_type = $form['#entity_type'];
$bundle = $form['#bundle'];
$view_mode = $form['#view_mode'];
$variable_name = 'fieldblock-' . $entity_type . '-' . $bundle . '-' . $view_mode;
$settings = variable_get($variable_name, array());
// Add a column header.
$form['fields']['#header'][] = t('Display as block');
// Add checkboxes.
$field_names = array_merge($form['#fields'], $form['#extra']);
foreach ($field_names as $field_name) {
$form['fields'][$field_name]['fieldblock'] = array(
'#type' => 'checkbox',
'#default_value' => isset($settings[$field_name]) ? true : false,
'#title' => '',
);
}
// Add a submit handler.
$form['#submit'][] = 'fieldblock_field_display_submit';
}