You are here

public function MySmsEventSubscriber::mySmsMessagePreprocess in SMS Framework 8

Same name and namespace in other branches
  1. 2.x sms.api.php \MySmsEventSubscriber::mySmsMessagePreprocess()
  2. 2.1.x sms.api.php \MySmsEventSubscriber::mySmsMessagePreprocess()

An example event subscriber.

See also

\Drupal\sms\Event\SmsEvents::MESSAGE_PRE_PROCESS

File

./sms.api.php, line 62
SMS Framework hooks.

Class

MySmsEventSubscriber
Event subscribers for SMS Framework.

Code

public function mySmsMessagePreprocess(\Drupal\sms\Event\SmsMessageEvent $event) {
  $result = [];
  foreach ($event
    ->getMessages() as $message) {

    // Modify or chunk messages.
    $result[] = $message;
  }
  $event
    ->setMessages($result);
}