You are here

function hook_tmgmt_job_after_request_translation in Translation Management Tool 8

Allows to alter job checkout workflow after the default behavior.

Parameters

\Drupal\tmgmt\JobInterface $job: The Job being submitted.

3 invocations of hook_tmgmt_job_after_request_translation()
ContinuousManager::addItem in src/ContinuousManager.php
Creates job item and submits according to the configured settings.
Job::requestTranslation in src/Entity/Job.php
Request the translation of a job from the translator.
tmgmt_cron in ./tmgmt.module
Implements hook_cron().

File

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

Code

function hook_tmgmt_job_after_request_translation(JobInterface $job) {

  /** @var \Drupal\tmgmt\Data $data_service */
  $data_service = \Drupal::service('tmgmt.data');

  // Reset the previous done changes to the data for example.
  foreach ($job
    ->getItems() as $job_item) {
    $unfiltered_data = $job_item
      ->getData();
    $data_items = $data_service
      ->filterTranslatable($unfiltered_data);
    foreach ($data_items as $data_item) {
      $data_item['property'] = 'old value';
    }
  }
}