Elgg\Notifications\Notification::getSender PHP Method

getSender() public method

Get the sender entity
public getSender ( ) : ElggEntity
return ElggEntity
    public function getSender()
    {
        return $this->from;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Get the subscribers for a new group which needs admin approval
  *
  * @param string                           $hook         the name of the hook
  * @param string                           $type         the type of the hook
  * @param \Elgg\Notifications\Notification $return_value current return value
  * @param array                            $params       supplied params
  *
  * @return void|\Elgg\Notifications\Notification
  */
 public static function prepareAdminApprovalMessage($hook, $type, $return_value, $params)
 {
     if (!$return_value instanceof \Elgg\Notifications\Notification) {
         return;
     }
     $actor = $return_value->getSender();
     $recipient = $return_value->getRecipient();
     $language = elgg_extract('language', $params);
     $event = elgg_extract('event', $params);
     if (!$event instanceof \Elgg\Notifications\Event) {
         return;
     }
     $group = $event->getObject();
     if (!$group instanceof \ElggGroup) {
         return;
     }
     $return_value->subject = elgg_echo('group_tools:group:admin_approve:admin:subject', [$group->name], $language);
     $return_value->summary = elgg_echo('group_tools:group:admin_approve:admin:summary', [$group->name], $language);
     $return_value->body = elgg_echo('group_tools:group:admin_approve:admin:message', [$recipient->name, $actor->name, $group->name, $group->getURL(), elgg_normalize_url('admin/groups/admin_approval')], $language);
     return $return_value;
 }
All Usage Examples Of Elgg\Notifications\Notification::getSender