You are here

function mandrill_template_map_form_submit in Mandrill 7.2

Same name and namespace in other branches
  1. 7 modules/mandrill_template/mandrill_template.admin.inc \mandrill_template_map_form_submit()

Submit handler for mandrill_template_map(), creates the entity.

File

modules/mandrill_template/mandrill_template.admin.inc, line 164
Administrative forms for Mandrill Template module.

Code

function mandrill_template_map_form_submit($form, &$form_state) {
  $values = $form_state['values'];
  if ($form_state['op'] == 'add' || $form_state['op'] == 'clone') {
    $map = entity_create('mandrill_template_map', $values);
  }
  else {
    $map = $form_state['mandrill_template_map'];
    foreach ($values as $key => $val) {
      $map->{$key} = $val;
    }
  }
  $map
    ->save();
  drupal_set_message(t('Mandrill template mapping saved.'));
  $form_state['redirect'] = 'admin/config/services/mandrill/templates';
}