You are here

function styles_ui_style_add_form_submit in Styles 7.2

Submission handler for the add style form.

File

contrib/styles_ui/styles_ui.admin.inc, line 98
Administrative page callbacks for the Styles UI module.

Code

function styles_ui_style_add_form_submit(&$form, &$form_state) {
  $field_type = $form_state['values']['field_type'];
  $style_name = $form_state['values']['name'];
  $style = array(
    'field_type' => $field_type,
    'name' => $style_name,
    'description' => '',
  );

  // Save the new style.
  styles_style_save($style);

  // Get the containers for this field type.
  $styles_containers = styles_default_containers();
  $field_containers = $styles_containers[$field_type];

  // Redirect to this style's edit page.
  $form_state['redirect'] = $field_containers['admin']['path'] . '/edit/' . $style_name;
}