Notifications service.
More...
|
| | __construct (protected Queue $queue, protected \ElggSession $session, protected EventsService $elgg_events) |
| | Constructor. More...
|
| |
| | registerEvent (string $type, string $subtype, string $action='create', string $handler=NotificationEventHandler::class) |
| | Register a notification event. More...
|
| |
| | unregisterEvent (string $type, string $subtype, string $action='create', string $handler=NotificationEventHandler::class) |
| | Unregister a notification event. 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 (int $stopTime) |
| | 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...
|
| |
| | sendInstantNotification (\ElggUser $recipient, string $action, \ElggData $subject, array $params=[], ?\ElggEntity $from=null) |
| | Send an instant notification to a user. More...
|
| |
Notifications service.
Definition at line 16 of file NotificationsService.php.
◆ __construct()
| Elgg\Notifications\NotificationsService::__construct |
( |
protected Queue |
$queue, |
|
|
protected \ElggSession |
$session, |
|
|
protected EventsService |
$elgg_events |
|
) |
| |
◆ enqueueEvent()
| 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 |
| null | \ElggEntity | $actor | (optional) The actor of the notification (default: logged-in user or owner of $object) |
- Returns
- void
Definition at line 178 of file NotificationsService.php.
◆ getEvents()
| Elgg\Notifications\NotificationsService::getEvents |
( |
| ) |
|
◆ getInstantHandlers()
| Elgg\Notifications\NotificationsService::getInstantHandlers |
( |
string |
$type, |
|
|
string |
$subtype, |
|
|
string |
$action |
|
) |
| |
|
protected |
Get the instant notification handlers.
- Parameters
-
| string | $type | 'object', 'user', 'group', 'site' |
| string | $subtype | The subtype of the entity |
| string | $action | The notification action |
- Returns
- array
Definition at line 241 of file NotificationsService.php.
◆ getMethods()
| Elgg\Notifications\NotificationsService::getMethods |
( |
| ) |
|
◆ getSubscriptionHandlers()
| Elgg\Notifications\NotificationsService::getSubscriptionHandlers |
( |
string |
$type, |
|
|
string |
$subtype, |
|
|
string |
$action |
|
) |
| |
|
protected |
Get the subscription notification handlers.
- Parameters
-
| string | $type | 'object', 'user', 'group', 'site' |
| string | $subtype | The subtype of the entity |
| string | $action | The notification action |
- Returns
- array
Definition at line 215 of file NotificationsService.php.
◆ isRegisteredMethod()
| Elgg\Notifications\NotificationsService::isRegisteredMethod |
( |
string |
$method | ) |
|
Check if a notification method is registed.
- Parameters
-
| string | $method | the notification method |
- Returns
- bool
Definition at line 165 of file NotificationsService.php.
◆ processQueue()
| Elgg\Notifications\NotificationsService::processQueue |
( |
int |
$stopTime | ) |
|
Pull notification events from queue until stop time is reached.
- Parameters
-
| int | $stopTime | The Unix time to stop sending notifications |
- Returns
- int The number of notification events handled
Definition at line 273 of file NotificationsService.php.
◆ registerEvent()
| Elgg\Notifications\NotificationsService::registerEvent |
( |
string |
$type, |
|
|
string |
$subtype, |
|
|
string |
$action = 'create', |
|
|
string |
$handler = NotificationEventHandler::class |
|
) |
| |
◆ registerMethod()
| Elgg\Notifications\NotificationsService::registerMethod |
( |
string |
$name | ) |
|
◆ sendInstantNotification()
| Elgg\Notifications\NotificationsService::sendInstantNotification |
( |
\ElggUser |
$recipient, |
|
|
string |
$action, |
|
|
\ElggData |
$subject, |
|
|
array |
$params = [], |
|
|
?\ElggEntity |
$from = null |
|
) |
| |
Send an instant notification to a user.
- Parameters
-
| \ElggUser | $recipient | The recipient user |
| string | $action | The action on $subject |
| \ElggData | $subject | The notification subject |
| array | $params | Additional params use $params['methods_override'] to override the recipient notification methods (eg 'email' or 'site') |
| null | \ElggEntity | $from | Sender of the message |
- Returns
- array
- Since
- 6.3
Definition at line 383 of file NotificationsService.php.
◆ sendInstantNotifications()
| 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 |
| \ElggUser[] | $recipients | An array of entities to notify |
| array | $params | Notification parameters |
@uses $params['subject'] string Default message subject @uses $params['body'] string Default message body @uses $params['object'] null|\ElggEntity|\ElggAnnotation The object that is triggering the notification. @uses $params['action'] null|string Word that describes the action that is triggering the notification (e.g. "create" or "update"). Defaults to "notify_user" @uses $params['summary'] null|string Summary that notification plugins can use alongside the notification title and body. @uses $params['methods_override'] string|array A string, or an array of strings specifying the delivery methods to use - or leave blank for delivery using the user's chosen delivery methods.
- Returns
- array
Definition at line 354 of file NotificationsService.php.
◆ unregisterEvent()
| Elgg\Notifications\NotificationsService::unregisterEvent |
( |
string |
$type, |
|
|
string |
$subtype, |
|
|
string |
$action = 'create', |
|
|
string |
$handler = NotificationEventHandler::class |
|
) |
| |
◆ unregisterMethod()
| Elgg\Notifications\NotificationsService::unregisterMethod |
( |
string |
$name | ) |
|
◆ $events
| array Elgg\Notifications\NotificationsService::$events = [] |
|
protected |
◆ $methods
| array Elgg\Notifications\NotificationsService::$methods = [] |
|
protected |
The documentation for this class was generated from the following file: