-
Notifications
You must be signed in to change notification settings - Fork 0
/
slides.install
executable file
·92 lines (84 loc) · 2.3 KB
/
slides.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
<?php
/**
* @file
* Install, update and uninstall functions for the slides module.
*/
/**
* Implements hook_install().
*/
function slides_install() {
// Add the node type.
_slides_install_type_create();
}
/**
* Implements hook_uninstall().
*/
function slides_uninstall() {
variable_del('slides_allowed_types');
variable_del('slides_child_type');
variable_del('slides_block_mode');
// Delete menu links.
db_delete('menu_links')
->condition('module', 'slides')
->execute();
menu_cache_clear_all();
}
function _slides_install_type_create() {
// Create an additional node type.
$slides_node_type = array(
'type' => 'slides',
'name' => t('Slide page'),
'base' => 'node_content',
'description' => t('<em>Slides</em> have a built-in hierarchical navigation. Use for handslidess or tutorials.'),
'custom' => 1,
'modified' => 1,
'locked' => 0,
);
$slides_node_type = node_type_set_defaults($slides_node_type);
node_type_save($slides_node_type);
node_add_body_field($slides_node_type);
// Default to not promoted.
variable_set('node_options_slides', array('status'));
// Use this default type for adding content to slidess.
variable_set('slides_allowed_types', array('slides'));
variable_set('slides_child_type', 'slides');
}
/**
* Implements hook_schema().
*/
function slides_schema() {
$schema['slides'] = array(
'description' => 'Stores slides outline information. Uniquely connects each node in the outline to a link in {menu_links}',
'fields' => array(
'mlid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => "The slides page's {menu_links}.mlid.",
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => "The slides page's {node}.nid.",
),
'bid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => "The slides ID is the {slides}.nid of the top-level page.",
),
),
'primary key' => array('mlid'),
'unique keys' => array(
'nid' => array('nid'),
),
'indexes' => array(
'bid' => array('bid'),
),
);
return $schema;
}