You are here

function simplenews_node_presave in Simplenews 7

Same name and namespace in other branches
  1. 8.2 simplenews.module \simplenews_node_presave()
  2. 8 simplenews.module \simplenews_node_presave()
  3. 3.x simplenews.module \simplenews_node_presave()

Implements hook_node_presave().

File

./simplenews.module, line 417
Simplenews node handling, sent email, newsletter block and general hooks

Code

function simplenews_node_presave($node) {
  if (!simplenews_check_node_types($node->type)) {
    return;
  }
  if (!empty($node->nid) && !isset($node->simplenews)) {
    $node->simplenews = simplenews_newsletter_load($node->nid);
  }
  if (empty($node->simplenews)) {
    $newsletter = (object) simplenews_newsletter_defaults($node);
  }
}