You are here

function tmgmt_test_tmgmt_source_suggestions in Translation Management Tool 8

Same name and namespace in other branches
  1. 7 tests/tmgmt_test.module \tmgmt_test_tmgmt_source_suggestions()

Implements hook_tmgmt_source_suggestions().

File

tmgmt_test/tmgmt_test.module, line 21
Module file of the translation management test module.

Code

function tmgmt_test_tmgmt_source_suggestions(array $items, JobInterface $job) {
  $suggestions = array();
  foreach ($items as $item) {
    if ($item
      ->getPlugin() == 'test_source') {
      $suggestions[] = array(
        'job_item' => tmgmt_job_item_create('test_source', $item
          ->getItemType() . '_suggestion', $item
          ->getItemId()),
        'reason' => t('Test suggestion for @type source @id', array(
          '@type' => $item
            ->getItemType(),
          '@id' => $item
            ->getItemId(),
        )),
        'from_item' => $item
          ->id(),
      );
    }
  }
  return $suggestions;
}