You are here

function data_ui_date_form_submit in Data 7

Submit handler for field date configuration.

File

data_ui/data_ui.admin.inc, line 891
Admin UI functions.

Code

function data_ui_date_form_submit($form, &$form_state) {
  $table = $form['#table'];
  $meta = $table
    ->get('meta');
  if (isset($form_state['values']['fields'])) {
    foreach ($form_state['values']['fields'] as $field_name => $settings) {
      foreach ($settings as $setting_name => $value) {
        $meta['fields'][$field_name]['date'][$setting_name] = $value;
      }
    }
  }
  $table
    ->update(array(
    'meta' => $meta,
  ));
  drupal_set_message(t("Date settings for the table have been saved."));

  // Date module uses the 'cache_views' table for date_views_fields(), so it's
  // fine to just clear the Views cache here.
  views_invalidate_cache();
}