You are here

public function LingotekConfigManagementForm::generateBulkOptions in Lingotek Translation 3.8.x

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

Get the bulk operations for the management form.

Return value

array Array with the bulk operations.

1 call to LingotekConfigManagementForm::generateBulkOptions()
LingotekConfigManagementForm::buildForm in src/Form/LingotekConfigManagementForm.php
Form constructor.

File

src/Form/LingotekConfigManagementForm.php, line 1685

Class

LingotekConfigManagementForm
Form for bulk management of content.

Namespace

Drupal\lingotek\Form

Code

public function generateBulkOptions() {
  $operations = [];
  $operations['upload'] = $this
    ->t('Upload source for translation');
  $operations['check_upload'] = $this
    ->t('Check upload progress');
  $operations[(string) $this
    ->t('Request translations')]['request_translations'] = $this
    ->t('Request all translations');
  $operations[(string) $this
    ->t('Check translation progress')]['check_translations'] = $this
    ->t('Check progress of all translations');
  $operations[(string) $this
    ->t('Download')]['download'] = $this
    ->t('Download all translations');
  $operations[(string) $this
    ->t('Cancel document')]['cancel'] = $this
    ->t('Cancel document');
  $target_languages = $this->languageManager
    ->getLanguages();
  $target_languages = array_filter($target_languages, function (LanguageInterface $language) {
    $configLanguage = ConfigurableLanguage::load($language
      ->getId());
    return $this->lingotekConfiguration
      ->isLanguageEnabled($configLanguage);
  });
  foreach ($target_languages as $langcode => $language) {
    $operations[(string) $this
      ->t('Cancel document')]['cancel:' . $langcode] = $this
      ->t('Cancel @language translation', [
      '@language' => $language
        ->getName() . ' (' . $language
        ->getId() . ')',
    ]);
    $operations[(string) $this
      ->t('Request translations')]['request_translation:' . $langcode] = $this
      ->t('Request @language translation', [
      '@language' => $language
        ->getName() . ' (' . $language
        ->getId() . ')',
    ]);
    $operations[(string) $this
      ->t('Check translation progress')]['check_translation:' . $langcode] = $this
      ->t('Check progress of @language translation', [
      '@language' => $language
        ->getName() . ' (' . $language
        ->getId() . ')',
    ]);
    $operations[(string) $this
      ->t('Download')]['download:' . $langcode] = $this
      ->t('Download @language translation', [
      '@language' => $language
        ->getName() . ' (' . $language
        ->getId() . ')',
    ]);
  }
  foreach ($this->lingotekConfiguration
    ->getProfileOptions() as $profile_id => $profile) {
    $operations[(string) $this
      ->t('Change Translation Profile')]['change_profile:' . $profile_id] = $this
      ->t('Change to @profile Profile', [
      '@profile' => $profile,
    ]);
  }
  $operations['Jobs management'] = [
    'assign_job' => $this
      ->t('Assign Job ID'),
    'clear_job' => $this
      ->t('Clear Job ID'),
  ];
  $debug_enabled = \Drupal::state()
    ->get('lingotek.enable_debug_utilities', FALSE);
  if ($debug_enabled) {
    $operations['debug']['debug.export'] = $this
      ->t('Debug: Export sources as JSON');
  }
  return $operations;
}