You are here

function simplenews_rules_action_subscribe in Simplenews 8

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

Action Implementation: Subscribe an e-mail adress to a Simplenews newsletter.

File

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

Code

function simplenews_rules_action_subscribe($args, $settings) {
  if ($args['language'] == LANGUAGE_NONE) {
    $args['language'] = NULL;
  }
  $confirmation = simplenews_rules_map_confirmation($args);

  // Pass the call forward.
  \Drupal::service('simplenews.subscription_manager')
    ->subscribe($args['mail'], $args['tid'], $confirmation, $args['source'], $args['language']);
}