You are here

function hook_message_subscribe_get_subscribers in Message Subscribe 8

Same name and namespace in other branches
  1. 7 message_subscribe.api.php \hook_message_subscribe_get_subscribers()

Allow modules to add user IDs that need to be notified.

Parameters

\Drupal\message\MessageInterface $message: The message object.

array $subscribe_options: Subscription options as defined by \Drupal\message\MessageInterface::sendMessage().

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 value

\Drupal\message_subscribe\Subscribers\DeliveryCandidateInterface[] An array, keyed by recipeint user ID, of delivery candidate objects.

2 functions implement hook_message_subscribe_get_subscribers()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

message_subscribe_message_subscribe_get_subscribers in ./message_subscribe.module
Implements hook_message_subscribe_get_subscribers().
message_subscribe_test_message_subscribe_get_subscribers in tests/modules/message_subscribe_test/message_subscribe_test.module
Implements hook_message_subscribe_get_subscribers().
1 invocation of hook_message_subscribe_get_subscribers()
Subscribers::getSubscribers in src/Subscribers.php
Retrieve a list of subscribers for a given entity.

File

./message_subscribe.api.php, line 33
Hooks provided by the Message subscribe module.

Code

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),
  ];
}