public function AuthorForm::validateForm in WordPress Migrate 8.3
Form validation 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 FormBase::validateForm
File
- wordpress_migrate_ui/
src/ Form/ AuthorForm.php, line 55
Class
- AuthorForm
- Simple wizard step form.
Namespace
Drupal\wordpress_migrate_ui\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
if (!$form_state
->getValue('perform_user_migration')) {
$account = user_load_by_name($form_state
->getValue('default_author'));
if (!$account) {
$form_state
->setErrorByName('default_author_uid', $this
->t('@name is not a valid username', [
'@name' => $form_state
->getValue('default_author'),
]));
}
}
}