Elgg\Notifications\NotificationEvent::getObject PHP Method

getObject() public method

Get the object of the event
public getObject ( ) : ElggData
return ElggData
    public function getObject();

Usage Example

Exemplo n.º 1
0
 /**
  * Get the subscriptions for this notification event
  *
  * The return array is of the form:
  *
  * array(
  *     <user guid> => array('email', 'sms', 'ajax'),
  * );
  *
  * @param NotificationEvent $event Notification event
  * @return array
  */
 public function getSubscriptions(NotificationEvent $event)
 {
     $subscriptions = array();
     if (!$this->methods) {
         return $subscriptions;
     }
     $object = $event->getObject();
     if (!$object) {
         return $subscriptions;
     }
     // get subscribers only for \ElggEntity if it isn't private
     if ($object instanceof \ElggEntity && $object->access_id !== ACCESS_PRIVATE) {
         $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, 'origin' => Notification::ORIGIN_SUBSCRIPTIONS);
     return _elgg_services()->hooks->trigger('get', 'subscriptions', $params, $subscriptions);
 }
All Usage Examples Of Elgg\Notifications\NotificationEvent::getObject