Error message

  • Warning: count(): Parameter must be an array or an object that implements Countable in _api_make_match_member_link() (line 1230 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).
  • Warning: count(): Parameter must be an array or an object that implements Countable in _api_make_match_member_link() (line 1230 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).

public function Html::export

Implements TMGMTFileExportInterface::export().

Overrides FormatInterface::export

File

translators/tmgmt_file/src/Plugin/tmgmt_file/Format/Html.php, line 41

Class

Html
Export into HTML.

Namespace

Drupal\tmgmt_file\Plugin\tmgmt_file\Format

Code

public function export(JobInterface $job, $conditions = array()) {
  $items = array();
  foreach ($job
    ->getItems($conditions) as $item) {
    $data = \Drupal::service('tmgmt.data')
      ->filterTranslatable($item
      ->getData());
    foreach ($data as $key => $value) {
      $items[$item
        ->id()][$this
        ->encodeIdSafeBase64($item
        ->id() . '][' . $key)] = $value;
    }
  }
  $elements = array(
    '#theme' => 'tmgmt_file_html_template',
    '#tjid' => $job
      ->id(),
    '#source_language' => $job
      ->getRemoteSourceLanguage(),
    '#target_language' => $job
      ->getRemoteTargetLanguage(),
    '#items' => $items,
  );
  return \Drupal::service('renderer')
    ->renderPlain($elements);
}