public function SmsDevelMessageForm::submitReceive in SMS Framework 8
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- modules/
sms_devel/ src/ Form/ SmsDevelMessageForm.php, line 186
Class
- SmsDevelMessageForm
- Simulate a message being sent or received.
Namespace
Drupal\sms_devel\FormCode
public function submitReceive(array &$form, FormStateInterface $form_state) {
$this->message
->setDirection(Direction::INCOMING);
$result = new SmsMessageResult();
// Create some fake reports.
foreach ($this->message
->getRecipients() as $recipient) {
$report = (new SmsDeliveryReport())
->setRecipient($recipient);
$result
->addReport($report);
}
$this->message
->setResult($result);
if ($form_state
->getValue('skip_queue')) {
$messages = $this->smsProvider
->incoming($this->message);
foreach ($messages as $message) {
$result = $message
->getResult();
$this
->resultMessage($result);
}
}
else {
$this->smsProvider
->queue($this->message);
drupal_set_message($this
->t('Message added to the incoming queue.'));
}
}