You are here

function pwa_webpush_send_message_account in Progressive Web App 7.2

Send a simple message alert to a single account.

File

modules/pwa_webpush/pwa_webpush.module, line 400

Code

function pwa_webpush_send_message_account($account, $title, $body, $url, $icon) {
  if (!is_object($account) || !is_numeric($account->uid)) {
    watchdog('pwa_webpush', 'Not a valid account object.');
    return FALSE;
  }
  $notification = [
    'title' => $title,
    'body' => $body,
    'icon' => $icon,
    'data' => [
      'url' => $url,
    ],
  ];
  pwa_webpush_send($notification, [
    $account->uid,
  ]);
}