You are here

public function VerifyPhoneNumberForm::submitForm 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.

Overrides FormInterface::submitForm

File

src/Form/VerifyPhoneNumberForm.php, line 119

Class

VerifyPhoneNumberForm
Form to accept a verification code.

Namespace

Drupal\sms\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $code = $form_state
    ->getValue('code');
  $phone_verification = $this->phoneNumberVerification
    ->getPhoneVerificationByCode($code);
  $phone_verification
    ->setStatus(TRUE)
    ->setCode('')
    ->save();
  drupal_set_message($this
    ->t('Phone number is now verified.'));
}