You are here

protected function LingotekJobManagementController::getAllConfigJobs in Lingotek Translation 3.2.x

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

File

src/Controller/LingotekJobManagementController.php, line 88

Class

LingotekJobManagementController
Form for bulk management of content.

Namespace

Drupal\lingotek\Controller

Code

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

  /** @var \Drupal\lingotek\Entity\LingotekConfigMetadata $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]['config'];
    }
  }
  return $jobs;
}