class Sms in Message Notify 8
SMS notifier.
@todo Add plugin definition.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\message_notify\Plugin\Notifier\MessageNotifierBase implements MessageNotifierInterface
- class \Drupal\message_notify\Plugin\Notifier\Sms
- class \Drupal\message_notify\Plugin\Notifier\MessageNotifierBase implements MessageNotifierInterface
Expanded class hierarchy of Sms
File
- src/
Plugin/ Notifier/ Sms.php, line 12
Namespace
Drupal\message_notify\Plugin\NotifierView source
class Sms extends MessageNotifierBase {
/**
* {@inheritdoc}
*/
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)) {
// Try to get the SMS number from the account.
$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']));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MessageNotifierBase:: |
protected | property | The entity type manager service. | |
MessageNotifierBase:: |
protected | property | The logger channel. | |
MessageNotifierBase:: |
protected | property | The message entity. | |
MessageNotifierBase:: |
protected | property | The rendering service. | |
MessageNotifierBase:: |
public | function |
Determine if user can access notifier. Overrides MessageNotifierInterface:: |
|
MessageNotifierBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
1 |
MessageNotifierBase:: |
public | function |
Save the rendered messages if needed.
Invoke watchdog error on failure. Overrides MessageNotifierInterface:: |
|
MessageNotifierBase:: |
public | function |
Entry point to send and process a message. Overrides MessageNotifierInterface:: |
|
MessageNotifierBase:: |
public | function |
Set the message object for the notifier. Overrides MessageNotifierInterface:: |
|
MessageNotifierBase:: |
public | function |
Constructs the plugin. Overrides PluginBase:: |
1 |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
Sms:: |
public | function |
Deliver a message via the required transport method. Overrides MessageNotifierInterface:: |