You are here

function simplenews_rules_action_send in Simplenews 8

Same name and namespace in other branches
  1. 8.2 simplenews_rules/simplenews_rules.rules.inc \simplenews_rules_action_send()
  2. 7.2 simplenews_rules/simplenews_rules.rules.inc \simplenews_rules_action_send()
  3. 7 simplenews_rules/simplenews_rules.rules.inc \simplenews_rules_action_send()
  4. 3.x simplenews_rules/simplenews_rules.rules.inc \simplenews_rules_action_send()

Action implementation, send a newsletter node.

File

simplenews_rules/simplenews_rules.rules.inc, line 188
Rules hooks for the Simplenews newsletter module.

Code

function simplenews_rules_action_send($node) {
  $newsletter = simplenews_newsletter_load($node->nid);
  if ($newsletter && ($newsletter->status != SIMPLENEWS_STATUS_SEND_PENDING || $newsletter->status != SIMPLENEWS_STATUS_SEND_PENDING)) {
    \Drupal::service('simplenews.spool_storage')
      ->addFromEntity($node);
  }
}