You are here

public function LingotekConfigManagementForm::submitForm in Lingotek Translation 8.2

Same name and namespace in other branches
  1. 8 src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::submitForm()
  2. 4.0.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::submitForm()
  3. 3.0.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::submitForm()
  4. 3.1.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::submitForm()
  5. 3.2.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::submitForm()
  6. 3.3.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::submitForm()
  7. 3.4.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::submitForm()
  8. 3.5.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::submitForm()
  9. 3.6.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::submitForm()
  10. 3.7.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::submitForm()
  11. 3.8.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::submitForm()

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/LingotekConfigManagementForm.php, line 427

Class

LingotekConfigManagementForm
Form for bulk management of content.

Namespace

Drupal\lingotek\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $operation = $form_state
    ->getValue('operation');
  $job_id = $form_state
    ->getValue('job_id') ?: NULL;
  $values = array_keys(array_filter($form_state
    ->getValue([
    'table',
  ])));
  $processed = FALSE;
  switch ($operation) {
    case 'debug.export':
      $this
        ->createDebugExportBatch($values);
      $processed = TRUE;
      break;
    case 'upload':
      $this
        ->createUploadBatch($values, $job_id);
      $processed = TRUE;
      break;
    case 'check_upload':
      $this
        ->createUploadCheckStatusBatch($values);
      $processed = TRUE;
      break;
    case 'request_translations':
      $this
        ->createRequestTranslationsBatch($values);
      $processed = TRUE;
      break;
    case 'check_translations':
      $this
        ->createTranslationCheckStatusBatch($values);
      $processed = TRUE;
      break;
    case 'download':
      $this
        ->createDownloadBatch($values);
      $processed = TRUE;
      break;
    case 'cancel':
      $this
        ->createCancelBatch($values);
      $processed = TRUE;
      break;
    case 'assign_job':
      $this
        ->redirectToAssignJobIdMultipleConfigForm($values, $form_state);
      $processed = TRUE;
      break;
    case 'clear_job':
      $this
        ->redirectToClearJobIdMultipleConfigForm($values, $form_state);
      $processed = TRUE;
      break;
  }
  if (!$processed) {
    if (0 === strpos($operation, 'request_translation:')) {
      list($operation, $language) = explode(':', $operation);
      $this
        ->createLanguageRequestTranslationBatch($values, $language);
      $processed = TRUE;
    }
    if (0 === strpos($operation, 'check_translation:')) {
      list($operation, $language) = explode(':', $operation);
      $this
        ->createLanguageTranslationCheckStatusBatch($values, $language);
      $processed = TRUE;
    }
    if (0 === strpos($operation, 'download:')) {
      list($operation, $language) = explode(':', $operation);
      $this
        ->createLanguageDownloadBatch($values, $language);
      $processed = TRUE;
    }
    if (0 === strpos($operation, 'cancel:')) {
      list($operation, $language) = explode(':', $operation);
      $this
        ->createTargetCancelBatch($values, $language);
      $processed = TRUE;
    }
    if (0 === strpos($operation, 'change_profile:')) {
      list($operation, $profile_id) = explode(':', $operation);
      $this
        ->createChangeProfileBatch($values, $profile_id);
      $processed = TRUE;
    }
  }
}