You are here

public function SpambotUserspamForm::submitForm in Spambot 8

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

\Drupal\Core\Entity\EntityStorageException

Overrides ConfigFormBase::submitForm

File

src/Form/SpambotUserspamForm.php, line 298

Class

SpambotUserspamForm
Settings form to save the configuration for Spambot.

Namespace

Drupal\spambot\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();

  /** @var \Drupal\user\UserInterface $account */
  $account = $this->entityTypeManager
    ->getStorage('user')
    ->load($values['uid']);
  $config = \Drupal::config('spambot.settings');
  if ($form_state
    ->getValue('op') == $form_state
    ->getValue('check')) {
    static::checkSubmit($account, $config);
  }
  elseif ($form_state
    ->getValue('op') == $form_state
    ->getValue('action')) {
    static::actionSubmit($form_state, $account, $config, $values);
  }
}