You are here

protected function LingotekApi::getCommentCreateWithTargetsParams in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.2 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::getCommentCreateWithTargetsParams()
  2. 7.4 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::getCommentCreateWithTargetsParams()

Gets the comment-specific parameters for use in a createContentDocumentWithTargets API call.

Parameters

LingotekComment: The comment entity to be translated.

Return value

array An array of API parameter values.

1 call to LingotekApi::getCommentCreateWithTargetsParams()
LingotekApi::getCreateWithTargetsParams in lib/Drupal/lingotek/LingotekApi.php
Collects the entity-specific parameter values for a document create API call.

File

lib/Drupal/lingotek/LingotekApi.php, line 251
Defines Drupal\lingotek\LingotekApi

Class

LingotekApi
@file Defines Drupal\lingotek\LingotekApi

Code

protected function getCommentCreateWithTargetsParams(LingotekComment $comment) {
  $source_language = Lingotek::convertDrupal2Lingotek($comment->language);
  $parameters = array(
    'projectId' => variable_get('lingotek_project', NULL),
    'documentName' => 'comment - ' . $comment->cid,
    'documentDesc' => 'comment ' . $comment->cid . ' on node ' . $comment->nid,
    'format' => $this
      ->xmlFormat(),
    'applyWorkflow' => 'true',
    'workflowId' => variable_get('lingotek_translate_comments_workflow_id', NULL),
    'sourceLanguage' => $source_language,
    'tmVaultId' => variable_get('lingotek_vault', 1),
    'content' => $comment
      ->documentLingotekXML(),
    'targetAsJSON' => Lingotek::availableLanguageTargetsWithoutSourceAsJSON($source_language),
    'note' => url('node/' . $comment->nid, array(
      'absolute' => TRUE,
      'alias' => TRUE,
    )),
  );
  $this
    ->addAdvancedParameters($parameters, $comment);
  return $parameters;
}