-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathelife_newsletter_marketing_messages.module
53 lines (41 loc) · 2.03 KB
/
elife_newsletter_marketing_messages.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
46
47
48
49
50
51
52
53
<?php
function elife_newsletter_marketing_messages_menu() {
$items['newsletters/marketing-message'] = [
'page callback' => 'elife_newsletter_marketing_messages_render',
'access callback' => TRUE,
];
$items['civicrm/mailing/elife-marketing-messages'] = [
'title' => 'Marketing messages for newsletters',
'page callback' => 'drupal_get_form',
'page arguments' => ['elife_newsletter_marketing_messages_form'],
'access arguments' => ['Edit marketing messages in elife newsletters'],
];
return $items;
}
function elife_newsletter_marketing_messages_permission() {
return array(
'Edit marketing messages in elife newsletters' => array(
'title' => t('Edit marketing messages in elife newsletters'),
),
);
}
function elife_newsletter_marketing_messages_render($type) {
drupal_json_output(['html' => variable_get("elife_newsletter_marketing_messages_{$type}_message")]);
}
function elife_newsletter_marketing_messages_form($form) {
$helpText = 'Only include plain text with html <a> tags, e.g. \'Find out more about <a href="https://elifesciences.org/about?{track}"">eLife sciences</a>\'.
To add the default tracking params, add a {track} token as a query param. Remember to add a \'?\' or \'&\' as appropriate before the token.';
$form['elife_newsletter_marketing_messages_vor_message'] = [
'#title' => 'VOR marketing message',
'#type' => 'textarea',
'#description' => $helpText,
'#default_value' => variable_get('elife_newsletter_marketing_messages_vor_message', 'Find out more about <a href="https://elifesciences.org/about?{track}"">eLife sciences</a>')
];
$form['elife_newsletter_marketing_messages_poa_message'] = [
'#title' => 'POA marketing message',
'#type' => 'textarea',
'#description' => $helpText,
'#default_value' => variable_get('elife_newsletter_marketing_messages_poa_message', 'Find out more about <a href="https://elifesciences.org/about?{track}"">eLife sciences</a>')
];
return system_settings_form($form);
}