function hook_tmgmt_source_suggestions

Return a list of suggested sources for job items.

Parameters

array $items: An array with JobItem objects which must be checked for suggested translations.

  • JobItem A JobItem to check for suggestions.
  • ...

\Drupal\tmgmt\JobInterface $job: The current translation job to check for additional translation items.

Return value

array An array with all additional translation suggestions.

  • job_item: A JobItem instance.
  • referenced: A string which indicates where this suggestion comes from.
  • from_job: The main Job-ID which suggests this translation.

Related topics

2 functions implement hook_tmgmt_source_suggestions()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

tmgmt_content_tmgmt_source_suggestions in sources/content/tmgmt_content.module
Implements hook_tmgmt_source_suggestions().
tmgmt_test_tmgmt_source_suggestions in tmgmt_test/tmgmt_test.module
Implements hook_tmgmt_source_suggestions().
1 invocation of hook_tmgmt_source_suggestions()
Job::getSuggestions in src/Entity/Job.php
Invoke the hook 'hook_tmgmt_source_suggestions' to get all suggestions.

File

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

Code

function hook_tmgmt_source_suggestions(array $items, JobInterface $job) {
  return array(
    array(
      'job_item' => tmgmt_job_item_create('entity', 'node', 0),
      'reason' => t('Referenced @type of field @label', array(
        '@type' => 'entity',
        '@label' => 'label',
      )),
      'from_item' => $items[1]
        ->id(),
    ),
  );
}