public function NewsletterTemplateController::save in Newsletter 7
Same name and namespace in other branches
- 7.2 modules/template/includes/newsletter_template.controller.inc \NewsletterTemplateController::save()
File
- includes/
newsletter.template.controller.inc, line 39 - Controller class definition file for newsletter_template entity.
Class
- NewsletterTemplateController
- Newsletter Template Controller
Code
public function save($template) {
$template->exposed = isset($template->exposed) ? $template->exposed : 0;
field_attach_presave('newsletter_template', $template);
if (!isset($template->ntid)) {
$template->created = REQUEST_TIME;
drupal_write_record('newsletter_template', $template);
field_attach_insert('newsletter_template', $template);
// Make sure to invoke the insert hook.
module_invoke_all('entity_insert', $template, 'newsletter_template');
}
else {
drupal_write_record('newsletter_template', $template, 'ntid');
field_attach_update('newsletter_template', $template);
// Make sure to invoke the update hook.
module_invoke_all('entity_update', $template, 'newsletter_template');
}
return $template;
}