public function TfaTestValidationPluginSetupPlugin::validateSetupForm in Two-factor Authentication (TFA) 8
Validate the setup data.
Parameters
array $form: The configuration form array.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
bool Whether or not form passes validation.
Overrides TfaSetupInterface::validateSetupForm
File
- tests/
modules/ tfa_test_plugins/ src/ Plugin/ TfaSetup/ TfaTestValidationPluginSetupPlugin.php, line 56
Class
- TfaTestValidationPluginSetupPlugin
- TFA Test Validation Plugin Setup Plugin.
Namespace
Drupal\tfa_test_plugins\Plugin\TfaSetupCode
public function validateSetupForm(array $form, FormStateInterface $form_state) {
$expected_value = $form_state
->getValue('expected_field');
if (empty($expected_value)) {
$form_state
->setError($form['expected_field'], $this
->t('Missing expected value.'));
return FALSE;
}
return TRUE;
}