You are here

function hook_tmgmt_job_checkout_before_alter in Translation Management Tool 8

Allows to alter job checkout workflow before the default behavior kicks in.

Note: The default behavior will ignore jobs that have already been checked out. Remove jobs from the array to prevent the default behavior for them.

Parameters

\Drupal\tmgmt\JobInterface[] $remaining_jobs: List of redirects the user is supposed to be redirected to.

\Drupal\tmgmt\JobInterface[] $jobs: Array with the translation jobs to be checked out.

2 invocations of hook_tmgmt_job_checkout_before_alter()
JobCheckoutManager::checkoutMultiple in src/JobCheckoutManager.php
Attempts to check out a number of jobs.
tmgmt_job_checkout_multiple in ./tmgmt.module
Attempts to check out a number of jobs. Performs a number of checks on each job and also allows to alter the behavior through hooks.

File

./tmgmt.api.php, line 238
Hooks provided by the Translation Management module.

Code

function hook_tmgmt_job_checkout_before_alter(&$remaining_jobs, &$jobs) {
  foreach ($jobs as $job) {

    // Automatically check out all jobs using the default settings.
    $job->translator = 'example';
    $job->translator_context = $job
      ->getTranslator()
      ->getPlugin()
      ->defaultCheckoutSettings();
  }
}