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