simplenews_rules.module in Simplenews 3.x
Same filename and directory in other branches
Module file for Simplenews rules integration.
File
simplenews_rules/simplenews_rules.moduleView source
<?php
/**
* @file
* Module file for Simplenews rules integration.
*/
use Drupal\simplenews\Entity\Newsletter;
define('SIMPLENEWS_RULES_CONFIRMATION_DEFAULT', 0);
define('SIMPLENEWS_RULES_CONFIRMATION_YES', 1);
define('SIMPLENEWS_RULES_CONFIRMATION_NO', 2);
/**
* Returns the options for the confirmation paramter.
*/
function simplenews_rules_confirmation_list() {
return array(
SIMPLENEWS_RULES_CONFIRMATION_DEFAULT => t('Default'),
SIMPLENEWS_RULES_CONFIRMATION_YES => t('Yes'),
SIMPLENEWS_RULES_CONFIRMATION_NO => t('No'),
);
}
/**
* Implements hook_simplenews_unsubscribe().
*/
function simplenews_rules_simplenews_unsubscribe($subscriber, $subscription) {
$args = array(
'mail' => $subscriber->mail,
'newsletter' => Newsletter::load($subscription->newsletter_id),
);
rules_invoke_event_by_args('simplenews_rules_event_unsubscribe', $args);
}
/**
* Implements hook_simplenews_subscribe().
*/
function simplenews_rules_simplenews_subscribe($subscriber, $subscription) {
$args = array(
'mail' => $subscriber->mail,
'newsletter' => Newsletter::load($subscription->newsletter_id),
);
rules_invoke_event_by_args('simplenews_rules_event_subscribe', $args);
}
Functions
Name | Description |
---|---|
simplenews_rules_confirmation_list | Returns the options for the confirmation paramter. |
simplenews_rules_simplenews_subscribe | Implements hook_simplenews_subscribe(). |
simplenews_rules_simplenews_unsubscribe | Implements hook_simplenews_unsubscribe(). |