You are here

function _tmgmt_ui_add_suggestion_item in Translation Management Tool 7

Create a Suggestion-Table entry based on a TMGMTJob and a title.

Parameters

array $result: Suggestion array with the keys job_item, reason and from_item.

Return value

array Options-Entry for a tableselect array.

1 call to _tmgmt_ui_add_suggestion_item()
_tmgmt_ui_translation_suggestions in ui/includes/tmgmt_ui.pages.inc
Fills the tableselect with all translation suggestions.

File

ui/includes/tmgmt_ui.pages.inc, line 678
Provides page callbacks and form functions for the Translation Management Tool User Interface module.

Code

function _tmgmt_ui_add_suggestion_item(array $result) {
  $item = $result['job_item'];
  $reason = isset($result['reason']) ? $result['reason'] : NULL;
  $option = array(
    'title' => $item
      ->label(),
    'plugin' => $item
      ->getSourceType(),
    'words' => $item
      ->getWordCount(),
    'reason' => $reason,
  );
  if (!empty($result['from_item'])) {
    $from_item = tmgmt_job_item_load($result['from_item']);
    if ($from_item) {
      $option['reason'] = t('%reason in %job', array(
        '%reason' => $option['reason'],
        '%job' => $from_item
          ->label(),
      ));
    }
  }
  return $option;
}