You are here

public function TestTranslator::rejectDataItem in Translation Management Tool 8

Reject one single data item.

@todo Using job item breaks the current convention which uses jobs.

Parameters

$job_item: The job item to which the rejected data item belongs.

$key: The key of the rejected data item. The key is an array containing the keys of a nested array hierarchy path.

Return value

TRUE if the reject was succesfull, else FALSE. In case of an error, it is the responsibility of the translator to provide informations about the faliure.

Overrides TranslatorRejectDataInterface::rejectDataItem

File

tmgmt_test/src/Plugin/tmgmt/Translator/TestTranslator.php, line 128

Class

TestTranslator
Test source plugin implementation.

Namespace

Drupal\tmgmt_test\Plugin\tmgmt\Translator

Code

public function rejectDataItem(JobItemInterface $job_item, array $key, array $values = NULL) {
  $key = '[' . implode('][', $key) . ']';
  $job_item
    ->addMessage('Rejected data item @key for job item @item in job @job.', array(
    '@key' => $key,
    '@item' => $job_item
      ->id(),
    '@job' => $job_item
      ->getJobId(),
  ));
  return TRUE;
}