You are here

protected function SmsDevelMessageForm::resultMessage in SMS Framework 8

Output a status message for a result object.

Parameters

\Drupal\sms\Message\SmsMessageResultInterface $result: An SMS result object.

2 calls to SmsDevelMessageForm::resultMessage()
SmsDevelMessageForm::submitReceive in modules/sms_devel/src/Form/SmsDevelMessageForm.php
Form submission handler.
SmsDevelMessageForm::submitSend in modules/sms_devel/src/Form/SmsDevelMessageForm.php
Form submission handler.

File

modules/sms_devel/src/Form/SmsDevelMessageForm.php, line 261

Class

SmsDevelMessageForm
Simulate a message being sent or received.

Namespace

Drupal\sms_devel\Form

Code

protected function resultMessage(SmsMessageResultInterface $result) {
  if ($status_code = $result
    ->getError()) {
    $status_message = $result
      ->getErrorMessage();
    drupal_set_message($this
      ->t('A problem occurred while attempting to process message: (code: @code) @message', [
      '@code' => $status_code,
      '@message' => $status_message,
    ]), 'error');
  }
  elseif ($report_count = count($result
    ->getReports())) {
    drupal_set_message($this
      ->t('Message was processed, @count delivery reports were generated.', [
      '@count' => $report_count,
    ]));
  }
  else {
    drupal_set_message($this
      ->t('An unknown error occurred while attempting to process message. No result or reports were generated by the gateway.'), 'error');
  }
}