-
Notifications
You must be signed in to change notification settings - Fork 0
/
emailmonkey.install
95 lines (88 loc) · 2.69 KB
/
emailmonkey.install
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/**
* @file emailmonkey.install
* Install, update, and uninstall the module.
*/
/**
* Declare the module's database schema.
*
* @see hook_schema()
*/
function emailmonkey_schema() {
$schema['emailmonkey_node_data'] = array(
'description' => 'Table to hold EmailMonkey data associated with nodes.',
'fields' => array(
'node_id' => array(
'description' => 'Node ID.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE),
'view_mode' => array(
'description' => 'View mode to use when exporting.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE)),
'primary key' => array('node_id'));
$schema['emailmonkey_campaigns'] = array(
'description' => 'Table to hold MailChimp campaigns associated with accounts and nodes.',
'fields' => array(
'node_id' => array(
'description' => 'Node ID.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE),
'account_id' => array(
'description' => 'MailChimp account ID.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE),
'campaign_id' => array(
'description' => 'MailChimp campaign ID.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE)),
'indexes' => array(
'nid_and_aid' => array('node_id', 'account_id')));
$schema['emailmonkey_styles'] = array(
'description' => 'Table to hold mappings between content type view modes and styles.',
'fields' => array(
'content_type' => array(
'description' => 'Content type.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE),
'view_mode' => array(
'description' => 'View mode.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE),
'style' => array(
'description' => 'Machine name of the style to use.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE)),
'indexes' => array(
'ct_and_vm' => array('content_type', 'view_mode')));
return $schema;
}
/**
* Install the module.
*
* @see hook_install()
*/
function emailmonkey_install() {
$t = get_t();
$config_url = url('admin/config/services/emailmonkey');
drupal_set_message($t('EmailMonkey has been installed. You also need to <a href="@config_url">configure it</a> before you can fully use it.', array('@config_url' => $config_url)));
}
/**
* Uninstall the module.
*
* @see hook_uninstall()
*/
function emailmonkey_uninstall() {
variable_del('emailmonkey_api_key');
variable_del('emailmonkey_account_id');
variable_del('emailmonkey_content_types');
variable_del('emailmonkey_styles');
}