You are here

function file_style_form_add_submit in Styles 7

Same name and namespace in other branches
  1. 7.2 contrib/file_styles/file_styles.admin.inc \file_style_form_add_submit()

Submit handler for adding a new file effect to a file style.

File

contrib/file_styles/file_styles.admin.inc, line 265
Administrative page callbacks for the File: Styles module.

Code

function file_style_form_add_submit($form, &$form_state) {
  $style = $form_state['file_style'];

  // Check if this field has any configuration options.
  $effect = file_effect_definition_load($form_state['values']['new']);

  // Load the configuration form for this option.
  if (isset($effect['form callback'])) {
    $path = 'admin/config/file/file-styles/edit/' . $form_state['file_style']['name'] . '/add/' . $form_state['values']['new'];
    $form_state['redirect'] = array(
      $path,
      array(
        'query' => array(
          'weight' => $form_state['values']['weight'],
        ),
      ),
    );
  }
  else {
    $effect['isid'] = $style['isid'];
    $effect['weight'] = $form_state['values']['weight'];
    file_effect_save($effect);
    drupal_set_message(t('The file effect was successfully applied.'));
  }
}