-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap_tour.api.php
More file actions
97 lines (88 loc) · 1.86 KB
/
bootstrap_tour.api.php
File metadata and controls
97 lines (88 loc) · 1.86 KB
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
96
97
<?php
/**
* @file
* Hooks provided by the Bootstrap Tour module.
*/
/**
* @defgroup bootstrap_tour_api_hooks Bootstrap tour API Hooks
* @{
* Functions to modify Bootstrap Tour entities.
* @}
*/
/**
* @addtogroup hooks
* @{
*/
/**
* Respond to Tour deletion.
* @param $tour
* The Tour entity that is being deleted.
*
*/
function hook_bootstrap_tour_delete($tour) {
db_delete('mytable')
->condition('tour_id', $tour->bootstrap_tour_step_id)
->execute();
}
/**
* Respond to deletion of a Tour revision.
*
* @param $tour
* The Tour revision (Tour object) that is being deleted.
*
* @ingroup bootstrap_tour_api_hooks
*/
function hook_bootstrap_tour_revision_delete($tour) {
db_delete('mytable')
->condition('vid', $tour->vid)
->execute();
}
/**
* Respond to creation of a new Tour.
*
* @param $tour
* The Tour that is being created.
*
* @ingroup bootstrap_tour_api_hooks
*/
function hook_bootstrap_tour_insert($tour) {
db_insert('mytable')
->fields(array(
'bootstrap_tour_step_id' => $tour->bootstrap_tour_step_id,
'extra' => $tour->extra,
))
->execute();
}
/**
* Act on a Tour being inserted or updated.
*
* @param $tour
* The Tour that is being inserted or updated.
*
* @ingroup bootstrap_tour_api_hooks
*/
function hook_bootstrap_tour_presave($tour) {
if ($tour->bootstrap_tour_step_id && $tour->moderate) {
// Reset votes when Tour is updated:
$tour->score = 0;
$tour->users = '';
$tour->votes = 0;
}
}
/**
* Respond to updates to a Tour.
*
* @param $tour
* The Tour that is being updated.
*
* @ingroup bootstrap_tour_api_hooks
*/
function hook_bootstrap_tour_update($tour) {
db_update('mytable')
->fields(array('extra' => $tour->extra))
->condition('bootstrap_tour_step_id', $tour->bootstrap_tour_step_id)
->execute();
}
/**
* @} End of "addtogroup hooks".
*/