Create a Suggestion-Table entry based on a Job and a title.
array $result: Suggestion array with the keys job_item, reason and from_item.
array Options-Entry for a tableselect array.
function addSuggestionItem(array $result) {
$item = $result['job_item'];
$reason = isset($result['reason']) ? $result['reason'] : NULL;
$option = array(
'title' => $item
->label(),
'type' => $item
->getSourceType(),
'words' => $item
->getWordCount(),
'tags' => $item
->getTagsCount(),
'reason' => $reason,
);
if (!empty($result['from_item'])) {
$from_item = JobItem::load($result['from_item']);
if ($from_item) {
$option['reason'] = t('%reason in %job', array(
'%reason' => $option['reason'],
'%job' => $from_item
->label(),
));
}
}
return $option;
}