public function UserForm::submitForm in Drupal-to-Drupal data migration 8.3
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
- migrate_d2d_ui/
src/ Form/ UserForm.php, line 127
Class
- UserForm
- Simple wizard step form.
Namespace
Drupal\migrate_d2d_ui\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$cached_values = $form_state
->getTemporaryValue('wizard');
if ($form_state
->getValue('do_migration')) {
$cached_values['user_migration'] = TRUE;
$cached_values['role_mappings'] = $form_state
->getValue('role');
$cached_values['default_role'] = $form_state
->getValue('default_role');
// Map "do not import" roles to the default role, and remove roles
// to be created so they get imported naturally.
foreach ($cached_values['role_mappings'] as $source_role => $destination_role) {
if ($destination_role == '-1') {
$cached_values['role_mappings'][$source_role] = $cached_values['default_role'];
}
elseif ($destination_role == '0') {
unset($cached_values['role_mappings'][$source_role]);
}
}
// Default role needs to be a rid.
$cached_values['default_role'] = array_search($cached_values['default_role'], user_role_names());
}
else {
$cached_values['user_migration'] = FALSE;
}
$form_state
->setTemporaryValue('wizard', $cached_values);
}