You are here

function ds_fieldgroup_form_submit in Display Suite 6

Same name and namespace in other branches
  1. 6.3 includes/ds.groups.inc \ds_fieldgroup_form_submit()
  2. 6.2 includes/ds.groups.inc \ds_fieldgroup_form_submit()

Save new fieldgroup.

1 string reference to 'ds_fieldgroup_form_submit'
ds_fieldgroup_form in includes/ds.groups.inc
Fieldgroup form.

File

includes/ds.groups.inc, line 176
Manage fieldgroups.

Code

function ds_fieldgroup_form_submit($form, &$form_state) {
  $module = $form['#module'];
  $fields = variable_get($module . '_fields', array());
  $key = $form_state['values']['key'];
  $fields[$key] = array(
    'title' => $form_state['values']['name'],
    'exclude' => $form_state['values']['exclude'],
    'type' => DS_FIELD_TYPE_GROUP,
    'status' => DS_FIELD_STATUS_STATIC,
    'properties' => array(
      'formatters' => array(
        'ds_field' => 'A simple div',
        'ds_group_fieldset_open' => 'Fieldset open',
        'ds_group_fieldset_collapsible' => 'Fieldset collapsible',
        'ds_group_fieldset_collapsed' => 'Fieldset collapsed',
      ),
    ),
  );

  // Tabs support.
  if (module_exists('tabs')) {
    $fields[$key]['properties']['formatters']['ds_tabs'] = 'Tabs';
  }

  // Safe field and invalidate cached fields.
  variable_set($module . '_fields', $fields);
  variable_del('ds_fields_cached');

  // Redirect and confirmation message.
  $form_state['redirect'] = 'admin/build/ds/' . $form['#module'] . '/fieldgroups';
  drupal_set_message(t('Fieldgroup %field has been saved.', array(
    '%field' => $form_state['values']['name'],
  )));
}