public function JobItem::needsReview in Translation Management Tool 8
Sets the state of the job item to 'needs review'.
Parameters
string $message: Message for the source to be reviewed.
array $variables: (optional) An array of variables to replace in the message on display.
string $type: (optional) Statically set to status.
Overrides JobItemInterface::needsReview
1 call to JobItem::needsReview()
- JobItem::addTranslatedData in src/
Entity/ JobItem.php - Adds translated data to a job item.
File
- src/
Entity/ JobItem.php, line 463
Class
- JobItem
- Entity class for the tmgmt_job_item entity.
Namespace
Drupal\tmgmt\EntityCode
public function needsReview($message = NULL, $variables = array(), $type = 'status') {
if (!isset($message)) {
$source_url = $this
->getSourceUrl();
$message = $source_url ? 'The translation for <a href=":source_url">@source</a> needs to be reviewed.' : 'The translation for @source needs to be reviewed.';
$variables = $source_url ? array(
':source_url' => $source_url,
'@source' => $this
->getSourceLabel(),
) : array(
'@source' => $this
->getSourceLabel(),
);
}
$return = $this
->setState(static::STATE_REVIEW, $message, $variables, $type);
// Auto accept the translation if the translator is configured for it.
if ($this
->getTranslator()
->isAutoAccept() && !$this
->isAborted()) {
try {
$this
->acceptTranslation();
} catch (\Exception $e) {
$this
->addMessage('Failed to automatically accept translation, error: @error', [
'@error' => $e
->getMessage(),
], 'error');
}
}
return $return;
}