Newer
Older
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
<?php
/**
* @file
* Custom hooks exposed by the recurring_events module.
*/
/**
* Alter the time options available when creating an event series entity.
*
* @param array $times
* An array of times in the format h:i a.
*/
function hook_recurring_events_times_alter(array &$times = []) {
// Events cannot occur at midnight.
unset($times['00:00 am']);
}
/**
* Alter the duration options available when creating an event series entity.
*
* @param array $durations
* An array of durations in seconds.
*/
function hook_recurring_events_durations_alter(array &$durations = []) {
// Events can last for 2 days.
$durations[172800] = t('2 days');
}
/**
* Alter the days options available when creating an event series entity.
*
* @param array $days
* An array of available days.
*/
function hook_recurring_events_days_alter(array &$days = []) {
// No events can take place on sundays.
unset($days['sunday']);
}
/**
* Alter the month days options available when creating an event series entity.
*
* @param array $month_days
* An array of available days of the month.
*/
function hook_recurring_events_month_days_alter(array &$month_days = []) {
// No events can take place on the 17th of a month.
unset($month_days[17]);
}
/**
* Alter the event instance entity prior to saving it when creating a series.
*
* @param array $event_instance
* An array of data to be stored against a event instance.
*/
function hook_recurring_events_event_instance_alter(array &$event_instance = []) {
// Change the series ID.
$event_instance['event_series_id'] = 12;
}
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
/**
* Alter the form config array after it has been generated.
*
* @param array $form_config
* An array of data representing the date recurring configuration.
*/
function hook_recurring_events_form_config_array_alter(array &$form_config = []) {
// Remove the first custom date.
unset($form_config['custom_dates'][0]);
}
/**
* Alter the entity config array after it has been generated.
*
* @param array $entity_config
* An array of data representing the date recurring configuration.
*/
function hook_recurring_events_entity_config_array_alter(array &$entity_config = []) {
// Remove the first custom date.
unset($form_config['custom_dates'][0]);
}
/**
* Alter the diff array after it has been generated.
*
* @param array $diff
* An array of differences between the stored and updated event date config.
*/
function hook_recurring_events_diff_array_alter(array &$diff = []) {
// Do not show differences in custom dates.
unset($form_config['custom_dates']);
}
/**
* Execute custom code before event instances are deleted.
*
* When an eventseries is updated and has date recurring configuration changes
* the EventCreationService will delete all the instances that existed before
* and recreate them. This hook allows you to execute code prior to the deletion
* of those instances.
*
* @param Drupal\recurring_events\Entity\EventSeries $event_series
* The eventseries being altered.
* @param Drupal\Core\Form\FormStateInterface $form_state
* The form state of an updated event series entity.
*/
function hook_recurring_events_save_pre_instances_deletion(EventSeries $event_series, FormStateInterface $form_state) {
}
/**
* Execute custom code after event instances are deleted.
*
* When an eventseries is updated and has date recurring configuration changes
* the EventCreationService will delete all the instances that existed before
* and recreate them. This hook allows you to execute code after the deletion
* of those instances.
*
* @param Drupal\recurring_events\Entity\EventSeries $event_series
* The eventseries being altered.
* @param Drupal\Core\Form\FormStateInterface $form_state
* The form state of an updated event series entity.
*/
function hook_recurring_events_save_post_instances_deletion(EventSeries $event_series, FormStateInterface $form_state) {
}
/**
* Execute custom code before a specific event instance is deleted.
*
* When an eventseries is updated and has date recurring configuration changes
* the EventCreationService will delete all the instances that existed before
* and recreate them. This hook allows you to execute code prior to the deletion
* of each instance.
*
* @param Drupal\recurring_events\Entity\EventSeries $event_series
* The eventseries being altered.
* @param Drupal\recurring_events\Entity\EventInstance $event_instance
* The event instance being deleted.
*/
function hook_recurring_events_save_pre_instance_deletion(EventSeries $event_series, EventInstance $event_instance) {
}
/**
* Execute custom code after a specific event instance is deleted.
*
* When an eventseries is updated and has date recurring configuration changes
* the EventCreationService will delete all the instances that existed before
* and recreate them. This hook allows you to execute code after the deletion
* of each instance.
*
* @param Drupal\recurring_events\Entity\EventSeries $event_series
* The eventseries being altered.
* @param Drupal\recurring_events\Entity\EventInstance $event_instance
* The event instance being deleted.
*/
function hook_recurring_events_save_post_instance_deletion(EventSeries $event_series, EventInstance $event_instance) {
}
/**
* Execute custom code before all instances are deleted.
*
* This hook differs to @see hook_recurring_events_save_pre_instances_deletion
* in that this hook fires before deleting instances by deleting the series
* rather than as a result of changing series date configuration.
*/
function hook_recurring_events_pre_delete_instances(EventSeries $event_series) {
}
/**
* Execute custom code after all instances are deleted.
*
* This hook differs to @see hook_recurring_events_save_post_instances_deletion
* in that this hook fires after deleting instances by deleting the series
* rather than as a result of changing series date configuration.
*/
function hook_recurring_events_post_delete_instance(EventSeries $event_series) {
}
/**
* Execute custom code before an instance is deleted.
*
* This hook differs to @see hook_recurring_events_save_pre_instance_deletion
* in that this hook fires before deleting an instance directly from the
* instance rather than as a result of changing series date configuration.
*/
function hook_recurring_events_pre_delete_instance(EventInstance $event_instance) {
}
/**
* Execute custom code after an instance is deleted.
*
* This hook differs to @see hook_recurring_events_save_post_instance_deletion
* in that this hook fires after deleting an instance directly from the
* instance rather than as a result of changing series date configuration.
*/
function hook_recurring_events_post_delete_instance(EventInstance $event_instance) {
}