function pet_add_form_submit in Previewable email templates 6
Update/create a PET.
File
- ./
pet.admin.inc, line 208 - Contains administrative pages for creating, editing, and deleting previewable email templates (PETs).
Code
function pet_add_form_submit($form, &$form_state) {
$values = $form_state['values'];
$values['body'] = $values['mail_body'];
unset($values['mail_body']);
if (empty($values['pid'])) {
drupal_write_record('pets', $values);
drupal_set_message(t('Template %name has been added.', array(
'%name' => $values['name'],
)));
watchdog('pet', 'Template %name has been added.', array(
'%name' => $values['name'],
), WATCHDOG_NOTICE);
}
else {
drupal_write_record('pets', $values, 'pid');
drupal_set_message(t('Template %name has been updated.', array(
'%name' => $values['name'],
)));
watchdog('pet', 'Template %name has been updated.', array(
'%name' => $values['name'],
), WATCHDOG_NOTICE);
}
$form_state['redirect'] = 'admin/build/pets';
}