You are here

function mb_content_admin_submit in More Buttons 7

Save settings from admin form.

File

mb_content/mb_content.admin.inc, line 137

Code

function mb_content_admin_submit($form, &$form_state) {
  $module = 'mb_content';
  $mappings = $form['#mappings'];
  if ($form_state['clicked_button']['#id'] == 'edit-save') {

    // Save the MB Content button and tab settings.
    foreach ($mappings as $type => $maps) {
      if ($type == 'panel') {
        continue;
      }
      variable_set($module . '_cancel_' . $type, $form_state['values'][$module . '_cancel_' . $type]);
      variable_set($module . '_sac_' . $type, $form_state['values'][$module . '_sac_' . $type]);
      variable_set($module . '_tabcn_' . $type, $form_state['values'][$module . '_tabcn_' . $type]);
    }
    drupal_set_message(t('The %module settings have been saved.', array(
      '%module' => t('More Buttons Content'),
    )), 'status');
  }
  elseif ($form_state['clicked_button']['#id'] == 'edit-reset') {
    $form_state['redirect'] = 'admin/config/mb/buttons/more-buttons-content/reset';
  }
}