public function Job::getSuggestions

Invoke the hook 'hook_tmgmt_source_suggestions' to get all suggestions.

Parameters

array $conditions: Conditions to pass only some and not all items to the hook.

Return value

array An array with all additional translation suggestions.

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

Overrides JobInterface::getSuggestions

File

src/Entity/Job.php, line 931

Class

Job
Entity class for the tmgmt_job entity.

Namespace

Drupal\tmgmt\Entity

Code

public function getSuggestions(array $conditions = array()) {
  $suggestions = \Drupal::moduleHandler()
    ->invokeAll('tmgmt_source_suggestions', array(
    $this
      ->getItems($conditions),
    $this,
  ));

  // EachJob needs a job id to be able to count the words, because the
  // source-language is stored in the job and not the item.
  foreach ($suggestions as &$suggestion) {
    $jobItem = $suggestion['job_item'];
    $jobItem->tjid = $this
      ->id();
    $jobItem
      ->recalculateStatistics();
  }
  return $suggestions;
}