Sms.php in Message Notify 8
File
src/Plugin/Notifier/Sms.php
View source
<?php
namespace Drupal\message_notify\Plugin\Notifier;
use Drupal\message_notify\Exception\MessageNotifyException;
class Sms extends MessageNotifierBase {
public function deliver(array $output = []) {
throw new MessageNotifyException('This functionality depends on the SMS Framework module. See: https://www.drupal.org/node/2582937');
if (empty($this->message->smsNumber)) {
$account = $this->message->uid->entitiy;
if (!empty($account->sms_user['number'])) {
$this->message->smsNumber = $account->sms_user['number'];
}
}
if (empty($this->message->smsNumber)) {
throw new MessageNotifyException('Message cannot be sent using SMS as the "smsNumber" property is missing from the Message entity or user entity.');
}
return sms_send($this->message->smsNumber, strip_tags($output['message_notify_sms_body']));
}
}