You are here

public function MobileNumberUtil::smsCallback in Mobile Number 8

Same name and namespace in other branches
  1. 2.0.x src/MobileNumberUtil.php \Drupal\mobile_number\MobileNumberUtil::smsCallback()

Gets sms callback for sending SMS's. The callback should accept $number and $message, and returns status booleans.

Return value

callable SMS callback.

Overrides MobileNumberUtilInterface::smsCallback

2 calls to MobileNumberUtil::smsCallback()
MobileNumberUtil::isSmsEnabled in src/MobileNumberUtil.php
Checks if sms sending is enabled.
MobileNumberUtil::sendSms in src/MobileNumberUtil.php
Sends an sms, based on callback provided by smsCallback().

File

src/MobileNumberUtil.php, line 352

Class

MobileNumberUtil
Turns a render array into a HTML string.

Namespace

Drupal\mobile_number

Code

public function smsCallback() {
  $module_handler = $this->moduleHandler;
  $callback = [];
  if ($module_handler
    ->moduleExists('sms')) {
    $callback = 'mobile_number_send_sms';
  }
  $module_handler
    ->alter('mobile_number_send_sms_callback', $callback);
  return is_callable($callback) ? $callback : FALSE;
}