You are here

public function LingotekJobManagementController::listJobs in Lingotek Translation 3.5.x

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

List of all the Translation Jobs.

1 string reference to 'LingotekJobManagementController::listJobs'
lingotek.routing.yml in ./lingotek.routing.yml
lingotek.routing.yml

File

src/Controller/LingotekJobManagementController.php, line 15

Class

LingotekJobManagementController
Form for bulk management of content.

Namespace

Drupal\lingotek\Controller

Code

public function listJobs() {
  $jobs = [];
  $jobs += $this
    ->getAllContentJobs($jobs);
  $jobs += $this
    ->getAllConfigJobs($jobs);
  $rows = array_map(function ($item) {
    return [
      'id' => $item['id'],
      'tagged' => $this
        ->t('@content content items, @config config items', [
        '@content' => $item['content'],
        '@config' => $item['config'],
      ]),
      'link' => [
        'data' => [
          '#type' => 'link',
          '#title' => 'View translation job',
          '#url' => Url::fromRoute('lingotek.translation_job_info', [
            'job_id' => $item['id'],
          ]),
          '#attributes' => [
            'title' => t('View translation job'),
          ],
        ],
      ],
    ];
  }, $jobs);
  $table = [
    '#type' => 'table',
    '#header' => [
      'id' => $this
        ->t('Job ID'),
      'tagged' => $this
        ->t('Elements'),
      'link' => '',
    ],
    '#rows' => $rows,
    '#empty' => $this
      ->t('There are no translation jobs. Use the Content or Config tabs to assign them.'),
  ];
  return $table;
}