Hooks and Events for SMS Framework

Last updated on
23 February 2017

This page outlines how your module can hook into SMS Framework.

Events

SMS Framework has adopted the event subscriber model introduced by Symfonys' EventDispatcher component. Full examples available can be found in sms.api.php. All available events can be found in src/Events/ directory. Event trigger names can be found in \Drupal\sms\Event\SmsEvents.

Determine gateway for each recipient

Event object: \Drupal\sms\Event\RecipientGatewayEvent

Triggered by events: sms.message.gateway
todo

Handle a received delivery report

Event object: \Drupal\sms\Event\SmsDeliveryReportEvent

Triggered by event: sms.report.post_process

todo

SMS messages are processed

Event object: \Drupal\sms\Event\SmsMessageEvent

Triggered by events:

  • sms.message.pre_process
  • sms.message.post_process
  • sms.message.queue.pre_process
  • sms.message.queue.post_process
  • sms.message.outgoing.pre_process
  • sms.message.outgoing.post_process
  • sms.message.incoming.pre_process
  • sms.message.incoming.post_process

todo

Alter hooks

Full examples can be found in sms.api.php.

Gateway info alter

Modules can modify annotations for each plugin instance by using hook_sms_gateway_info_alter.

Example

function hook_sms_gateway_info_alter(&$gateways) {
  $gateways['log']['label'] = new \Drupal\Core\StringTranslation\TranslatableMarkup('The Logger');
}

Help improve this page

Page status: No known problems

You can: