You are here

public function LingotekConfigManagementForm::submitForm in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 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 328
Contains \Drupal\Lingotek\Form\LingotekConfigManagementForm.

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');
  $values = array_keys(array_filter($form_state
    ->getValue([
    'table',
  ], function ($key, $value) {
    return $value;
  })));
  $processed = FALSE;
  switch ($operation) {
    case 'debug.export':
      $this
        ->createDebugExportBatch($values);
      $processed = TRUE;
      break;
    case 'upload':
      $this
        ->createUploadBatch($values);
      $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 'disassociate':
      $this
        ->createDisassociateBatch($values);
      $processed = TRUE;
      break;
    case 'delete_nodes':
      $this
        ->redirectToDeleteMultipleNodesForm($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;
    }
  }
}