You are here

public function LingotekManagementForm::generateBulkOptions in Lingotek Translation 8

Get the bulk operations for the management form.

Return value

array Array with the bulk operations.

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

File

src/Form/LingotekManagementForm.php, line 1175
Contains \Drupal\Lingotek\Form\LingotekManagementForm.

Class

LingotekManagementForm
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');
  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['disassociate'] = $this
    ->t('Disassociate content');
  foreach ($this->languageManager
    ->getLanguages() as $langcode => $language) {
    $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(),
    ]);
  }

  // We add the delete operation in nodes and comments, as we have those
  // operations in core.
  if ($this->entityTypeId === 'node') {
    $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;
}