Notifications service.
More...
|
| __construct (Queue $queue,\ElggSession $session, EventsService $elgg_events) |
| Constructor. More...
|
|
| registerEvent (string $type, string $subtype, array $actions=[], string $handler=NotificationEventHandler::class) |
| Register a notification event. More...
|
|
| unregisterEvent (string $type, string $subtype, array $actions=[]) |
| Unregister a notification event. More...
|
|
| isRegisteredEvent (string $type, string $subtype, string $action) |
| Check if a notification event is registered. More...
|
|
| getEvents () |
| Return the notification events. More...
|
|
| registerMethod (string $name) |
| Register a delivery method for notifications. More...
|
|
| unregisterMethod (string $name) |
| Unregister a delivery method for notifications. More...
|
|
| getMethods () |
| Returns registered delivery methods for notifications. More...
|
|
| isRegisteredMethod (string $method) |
| Check if a notification method is registed. More...
|
|
| enqueueEvent (string $action,\ElggData $object,\ElggEntity $actor=null) |
| Add a notification event to the queue. More...
|
|
| processQueue ($stopTime, $matrix=false) |
| Pull notification events from queue until stop time is reached. More...
|
|
| sendInstantNotifications (\ElggEntity $sender, array $recipients=[], array $params=[]) |
| Notify a user via their preferences. More...
|
|
Notifications service.
Definition at line 16 of file NotificationsService.php.
Elgg\Notifications\NotificationsService::enqueueEvent |
( |
string |
$action, |
|
|
\ElggData |
$object, |
|
|
\ElggEntity |
$actor = null |
|
) |
| |
Add a notification event to the queue.
- Parameters
-
string | $action | Action name |
\ElggData | $object | The object of the action |
\ElggEntity | $actor | (optional) The actor of the notification (default: logged in user or owner of $object) |
- Returns
- void
Definition at line 200 of file NotificationsService.php.
Elgg\Notifications\NotificationsService::getEvents |
( |
| ) |
|
Elgg\Notifications\NotificationsService::getMethods |
( |
| ) |
|
Elgg\Notifications\NotificationsService::getNotificationHandler |
( |
NotificationEvent |
$event | ) |
|
|
protected |
Elgg\Notifications\NotificationsService::isRegisteredEvent |
( |
string |
$type, |
|
|
string |
$subtype, |
|
|
string |
$action |
|
) |
| |
Check if a notification event is registered.
- Parameters
-
string | $type | 'object', 'user', 'group', 'site' |
string | $subtype | The subtype of the entity |
string | $action | The notification action to check |
- Returns
- bool
- Since
- 5.0
Definition at line 129 of file NotificationsService.php.
Elgg\Notifications\NotificationsService::isRegisteredMethod |
( |
string |
$method | ) |
|
Check if a notification method is registed.
- Parameters
-
string | $method | the notification method |
- Returns
- bool
Definition at line 187 of file NotificationsService.php.
Elgg\Notifications\NotificationsService::processQueue |
( |
|
$stopTime, |
|
|
|
$matrix = false |
|
) |
| |
Pull notification events from queue until stop time is reached.
- Parameters
-
int | $stopTime | The Unix time to stop sending notifications |
bool | $matrix | If true, will return delivery matrix instead of a notifications event count |
- Returns
- int|array The number of notification events handled, or a delivery matrix
Definition at line 253 of file NotificationsService.php.
Elgg\Notifications\NotificationsService::registerEvent |
( |
string |
$type, |
|
|
string |
$subtype, |
|
|
array |
$actions = [] , |
|
|
string |
$handler = NotificationEventHandler::class |
|
) |
| |
Register a notification event.
- Parameters
-
string | $type | 'object', 'user', 'group', 'site' |
string | $subtype | The subtype or name of the entity |
array | $actions | Array of actions or empty array for the action event. An event is usually described by the first string passed to elgg_trigger_event(). Examples include 'create', 'update', and 'publish'. The default is 'create'. |
string | $handler | NotificationEventHandler classname |
- Returns
- void
- Exceptions
-
- See also
- elgg_register_notification_event()
Definition at line 68 of file NotificationsService.php.
Elgg\Notifications\NotificationsService::registerMethod |
( |
string |
$name | ) |
|
Elgg\Notifications\NotificationsService::sendInstantNotifications |
( |
\ElggEntity |
$sender, |
|
|
array |
$recipients = [] , |
|
|
array |
$params = [] |
|
) |
| |
Notify a user via their preferences.
Returns an array in the form: [ 25 => [ 'email' => true, 'sms' => false, ], 55 => [], ]
- Parameters
-
\ElggEntity | $sender | Sender of the notification |
| | |
Definition at line 327 of file NotificationsService.php.
Elgg\Notifications\NotificationsService::unregisterEvent |
( |
string |
$type, |
|
|
string |
$subtype, |
|
|
array |
$actions = [] |
|
) |
| |
Unregister a notification event.
- Parameters
-
string | $type | 'object', 'user', 'group', 'site' |
string | $subtype | The subtype of the entity |
array | $actions | The notification action to unregister, leave empty for all actions |
- Returns
- void
- See also
- elgg_unregister_notification_event()
Definition at line 100 of file NotificationsService.php.
Elgg\Notifications\NotificationsService::unregisterMethod |
( |
string |
$name | ) |
|
Elgg\Notifications\NotificationsService::$elgg_events |
|
protected |
Elgg\Notifications\NotificationsService::$events = [] |
|
protected |
Elgg\Notifications\NotificationsService::$methods = [] |
|
protected |
Elgg\Notifications\NotificationsService::$queue |
|
protected |
Elgg\Notifications\NotificationsService::$session |
|
protected |
The documentation for this class was generated from the following file: