forked from Gizra/message_subscribe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
message_subscribe.api.php
72 lines (63 loc) · 2.22 KB
/
message_subscribe.api.php
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
<?php
/**
* @file
* Hooks provided by the Message subscribe module.
*/
/**
* @addtogroup hooks
* @{
*/
use Drupal\message\MessageInterface;
use Drupal\message_subscribe\Subscribers\DeliveryCandidate;
use Drupal\message_subscribe\Subscribers\DeliveryCandidateInterface;
/**
* Allow modules to add user IDs that need to be notified.
*
* @param \Drupal\message\MessageInterface $message
* The message object.
* @param array $subscribe_options
* Subscription options as defined by
* \Drupal\message\MessageInterface::sendMessage().
* @param array $context
* Array keyed with the entity type and array of entity IDs as the
* value. According to this context this function will retrieve the
* related subscribers.
*
* @return \Drupal\message_subscribe\Subscribers\DeliveryCandidateInterface[]
* An array, keyed by recipeint user ID, of delivery candidate objects.
*/
function hook_message_subscribe_get_subscribers(MessageInterface $message, array $subscribe_options = [], array $context = []) {
return [
2 => new DeliveryCandidate(['subscribe_node'], ['sms'], 2),
7 => new DeliveryCandidate(['subscribe_og', 'subscribe_user'], ['sms', 'email'], 7),
];
}
/**
* Alter the subscribers list.
*
* @param \Drupal\message_subscribe\Subscribers\DeliveryCandidateInterface[] &$uids
* The array of delivery candidates as defined by
* `hook_message_subscribe_get_subscribers()`.
* @param array $values
* A keyed array of values containing:
* - 'context' - The context array.
* - 'entity_type' - The entity type ID.
* - 'entity' - The entity object
* - 'subscribe_options' - The subscribe options array.
*/
function hook_message_subscribe_get_subscribers_alter(array &$uids, array $values) {
}
/**
* Alter the message entity immediately before it is sent.
*
* @param \Drupal\message\MessageInterface $message
* The message entity to be sent. This already has the recipient set as the
* message owner.
* @param \Drupal\message_subscribe\Subscribers\DeliveryCandidateInterface $delivery_candidate
* A delivery candidate object.
*/
function hook_message_subscribe_message_alter(MessageInterface $message, DeliveryCandidateInterface $delivery_candidate) {
}
/**
* @} End of "addtogroup hooks".
*/