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 (int $stopTime, bool $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...
|
| |
| | 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()
◆ 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 200 of file NotificationsService.php.
◆ getEvents()
| Elgg\Notifications\NotificationsService::getEvents |
( |
| ) |
|
◆ getMethods()
| Elgg\Notifications\NotificationsService::getMethods |
( |
| ) |
|
◆ getNotificationHandler()
| Elgg\Notifications\NotificationsService::getNotificationHandler |
( |
NotificationEvent |
$event, |
|
|
array |
$params = [] |
|
) |
| |
|
protected |
◆ isRegisteredEvent()
| 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.
◆ 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 187 of file NotificationsService.php.
◆ processQueue()
| Elgg\Notifications\NotificationsService::processQueue |
( |
int |
$stopTime, |
|
|
bool |
$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 262 of file NotificationsService.php.
◆ registerEvent()
| 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.
◆ 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 370 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 341 of file NotificationsService.php.
◆ unregisterEvent()
| 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.
◆ unregisterMethod()
| Elgg\Notifications\NotificationsService::unregisterMethod |
( |
string |
$name | ) |
|
◆ $elgg_events
| Elgg\Notifications\NotificationsService::$elgg_events |
|
protected |
◆ $events
| Elgg\Notifications\NotificationsService::$events = [] |
|
protected |
◆ $methods
| Elgg\Notifications\NotificationsService::$methods = [] |
|
protected |
◆ $queue
| Elgg\Notifications\NotificationsService::$queue |
|
protected |
◆ $session
| Elgg\Notifications\NotificationsService::$session |
|
protected |
The documentation for this class was generated from the following file: