-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsendy.module
45 lines (39 loc) · 1.11 KB
/
sendy.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* @file
* Contains sendy.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function sendy_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the sendy module.
case 'help.page.sendy':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('This module provides sendy.co integration') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function sendy_form_sendy_subscribe_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
// Support honeypot module.
if (\Drupal::moduleHandler()->moduleExists("honeypot")) {
honeypot_add_form_protection($form, $form_state, ['honeypot']);
}
}
/**
* Return all published newsletter lists.
* @return array
*/
function _sendy_get_newsletter_lists() {
$entity_ids = \Drupal::entityQuery('newsletter_list')
->condition('status', 1)
->execute();
return \Drupal::entityTypeManager()->getStorage('newsletter_list')->loadMultiple($entity_ids);
}