Elgg  Version master
MentionsEnqueueEventHandler.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Notifications;
4 
11 
15  protected static array $queued = [];
16 
24  public function __invoke(\Elgg\Event $event) {
25  $object = $event->getObject();
26  if (!$object instanceof \ElggEntity || $object->access_id === ACCESS_PRIVATE || in_array($object->guid, self::$queued)) {
27  return;
28  }
29 
30  // prevent double enqueue
31  self::$queued[] = $object->guid;
32 
33  _elgg_services()->notifications->enqueueEvent('mentions', $object);
34  }
35 }
const ACCESS_PRIVATE
Definition: constants.php:10
__invoke(\Elgg\Event $event)
Queue a mentions notification event for later handling.
if($email instanceof\Elgg\Email) $object
Definition: body.php:24
_elgg_services()
Get the global service provider.
Definition: elgglib.php:351
Models an event passed to event handlers.
Definition: Event.php:11