/**
* Get the subscriptions for this notification event
*
* The return array is of the form:
*
* array(
* <user guid> => array('email', 'sms', 'ajax'),
* );
*
* @param \Elgg\Notifications\Event $event Notification event
* @return array
*/
public function getSubscriptions(\Elgg\Notifications\Event $event)
{
$subscriptions = array();
if (!$this->methods) {
return $subscriptions;
}
$object = $event->getObject();
if (!$object) {
return $subscriptions;
}
$prefixLength = strlen(self::RELATIONSHIP_PREFIX);
$records = $this->getSubscriptionRecords($object->getContainerGUID());
foreach ($records as $record) {
$deliveryMethods = explode(',', $record->methods);
$subscriptions[$record->guid] = substr_replace($deliveryMethods, '', 0, $prefixLength);
}
$params = array('event' => $event);
return _elgg_services()->hooks->trigger('get', 'subscriptions', $params, $subscriptions);
}