You are here

public function LingotekManagementFormBase::generateBulkOptions in Lingotek Translation 3.4.x

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

Get the bulk operations for the management form.

Return value

array Array with the bulk operations.

1 call to LingotekManagementFormBase::generateBulkOptions()
LingotekManagementFormBase::getBulkOptions in src/Form/LingotekManagementFormBase.php
Gets the bulk options form array structure.

File

src/Form/LingotekManagementFormBase.php, line 1637

Class

LingotekManagementFormBase
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');
  if ($this
    ->canHaveDeleteTranslationBulkOptions()) {
    $operations[(string) $this
      ->t('Delete translations')]['delete_translations'] = $this
      ->t('Delete translations');
  }
  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[(string) $this
    ->t('Cancel document')]['cancel'] = $this
    ->t('Cancel document');
  foreach ($this->languageManager
    ->getLanguages() 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() . ')',
    ]);
    if ($this
      ->canHaveDeleteTranslationBulkOptions()) {
      $operations[(string) $this
        ->t('Delete translations')]['delete_translation:' . $langcode] = $this
        ->t('Delete @language translation', [
        '@language' => $language
          ->getName() . ' (' . $language
          ->getId() . ')',
      ]);
    }
  }
  $operations['Jobs management'] = [
    'assign_job' => $this
      ->t('Assign Job ID'),
    'clear_job' => $this
      ->t('Clear Job ID'),
  ];
  if ($this
    ->canHaveDeleteBulkOptions()) {
    $operations['delete_nodes'] = $this
      ->t('Delete content');
  }
  $debug_enabled = $this->state
    ->get('lingotek.enable_debug_utilities', FALSE);
  if ($debug_enabled) {
    $operations['debug']['debug.export'] = $this
      ->t('Debug: Export sources as JSON');
  }
  return $operations;
}