function views_field_form_field_ui_field_edit_form_alter in Views Field 7
Implements hook_form_FORM_ID_alter(): field_ui_field_edit_form.
1 call to views_field_form_field_ui_field_edit_form_alter()
- views_field_form_field_ui_field_settings_form_alter in ./
views_field.module - Implements hook_form_FORM_ID_alter(): field_ui_field_settings_form.
File
- ./
views_field.module, line 53 - Provides primary Drupal hook implementations.
Code
function views_field_form_field_ui_field_edit_form_alter(&$form, &$form_state) {
$field = $form['#field'];
$settings = $field['settings'];
// Handle fields without existing settings.
if (isset($form['field']['settings']['#markup'])) {
$form['field']['settings'] = array();
}
// Allow user to expose this field to views as a base table.
$form['field']['settings']['views_base_table'] = array(
'#type' => 'checkbox',
'#title' => t('Expose as base table'),
'#default_value' => $settings['views_base_table'],
'#description' => t('Expose the storage table for this field to the Views module as a base table.'),
);
// Allow user to select the columns of the field table to expose to views.
$columns = array();
foreach ($field['columns'] as $column_name => $attributes) {
$columns[] = $column_name;
}
$columns = array_merge($columns, array(
'entity_type',
'bundle',
'entity_id',
'revision_id',
'language',
'delta',
'deleted',
));
$form['field']['settings']['views_base_columns'] = array(
'#type' => 'select',
'#title' => t('Columns to expose'),
'#default_value' => $settings['views_base_columns'],
'#options' => drupal_map_assoc($columns),
'#description' => t('Expose the selected columns of the storage table for this field to the Views module as fields.'),
'#multiple' => TRUE,
'#size' => min(12, count($columns)),
);
}