You are here

protected function LingotekJobManagementController::getAllContentJobs in Lingotek Translation 3.4.x

Same name and namespace in other branches
  1. 8.2 src/Controller/LingotekJobManagementController.php \Drupal\lingotek\Controller\LingotekJobManagementController::getAllContentJobs()
  2. 4.0.x src/Controller/LingotekJobManagementController.php \Drupal\lingotek\Controller\LingotekJobManagementController::getAllContentJobs()
  3. 3.0.x src/Controller/LingotekJobManagementController.php \Drupal\lingotek\Controller\LingotekJobManagementController::getAllContentJobs()
  4. 3.1.x src/Controller/LingotekJobManagementController.php \Drupal\lingotek\Controller\LingotekJobManagementController::getAllContentJobs()
  5. 3.2.x src/Controller/LingotekJobManagementController.php \Drupal\lingotek\Controller\LingotekJobManagementController::getAllContentJobs()
  6. 3.3.x src/Controller/LingotekJobManagementController.php \Drupal\lingotek\Controller\LingotekJobManagementController::getAllContentJobs()
  7. 3.5.x src/Controller/LingotekJobManagementController.php \Drupal\lingotek\Controller\LingotekJobManagementController::getAllContentJobs()
  8. 3.6.x src/Controller/LingotekJobManagementController.php \Drupal\lingotek\Controller\LingotekJobManagementController::getAllContentJobs()
  9. 3.7.x src/Controller/LingotekJobManagementController.php \Drupal\lingotek\Controller\LingotekJobManagementController::getAllContentJobs()
  10. 3.8.x src/Controller/LingotekJobManagementController.php \Drupal\lingotek\Controller\LingotekJobManagementController::getAllContentJobs()
1 call to LingotekJobManagementController::getAllContentJobs()
LingotekJobManagementController::listJobs in src/Controller/LingotekJobManagementController.php
List of all the Translation Jobs.

File

src/Controller/LingotekJobManagementController.php, line 64

Class

LingotekJobManagementController
Form for bulk management of content.

Namespace

Drupal\lingotek\Controller

Code

protected function getAllContentJobs(array &$jobs) {
  $entity_query = \Drupal::entityQuery('lingotek_content_metadata');
  $entity_query
    ->exists('job_id');
  $ids = $entity_query
    ->execute();
  $metadatas = $this
    ->entityTypeManager()
    ->getStorage('lingotek_content_metadata')
    ->loadMultiple($ids);

  /** @var \Drupal\lingotek\Entity\LingotekContentMetadata $metadata */
  foreach ($metadatas as $metadata) {
    $job_id = $metadata
      ->getJobId();
    if (!empty($job_id)) {
      if (!isset($jobs[$job_id])) {
        $jobs[$job_id] = [
          'id' => $job_id,
          'content' => 0,
          'config' => 0,
        ];
      }
      ++$jobs[$job_id]['content'];
    }
  }
  return $jobs;
}