public function CloneEntityType::submitForm in Entity Type Clone 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/ CloneEntityType.php, line 174
Class
- CloneEntityType
- Class CloneEntityType.
Namespace
Drupal\entity_type_clone\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// Get the form state values.
$values = $form_state
->getValues();
$op = (string) $values['op'];
if ($op == $this
->t('Reset')) {
$form_state
->setRedirect('entity_type_clone.type');
}
elseif ($op == $this
->t('Clone')) {
// Create the batch process for clone operations.
$batch = [
'title' => $this
->t('Cloning in process.'),
'operations' => $this
->cloneEntityType($form_state),
'init_message' => $this
->t('Performing clone operations...'),
'finished' => '\\Drupal\\entity_type_clone\\Form\\CloneEntityTypeData::cloneEntityTypeFinishedCallback',
'error_message' => $this
->t('Something went wrong. Please check the errors log.'),
];
batch_set($batch);
}
}