You are here

protected function LingotekApi::getConfigChunkCreateWithTargetsParams in Lingotek Translation 7.3

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

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

Parameters

LingotekConfigChunk: The config chunk to be translated.

Return value

array An array of API parameter values.

1 call to LingotekApi::getConfigChunkCreateWithTargetsParams()
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 282
Defines Drupal\lingotek\LingotekApi

Class

LingotekApi
@file Defines Drupal\lingotek\LingotekApi

Code

protected function getConfigChunkCreateWithTargetsParams(LingotekConfigChunk $chunk) {
  $target_locales = Lingotek::availableLanguageTargets("lingotek_locale");
  $parameters = array(
    'projectId' => variable_get('lingotek_project', NULL),
    'documentName' => 'config - ' . $chunk->cid,
    'documentDesc' => 'configuration string set "' . $chunk->cid . '", related to menus, taxonomies, views, etc.',
    'format' => $this
      ->xmlFormat(),
    'applyWorkflow' => 'true',
    'workflowId' => variable_get('lingotek_translate_config_chunks_workflow_id', NULL),
    'sourceLanguage' => Lingotek::convertDrupal2Lingotek($chunk->language),
    'tmVaultId' => variable_get('lingotek_vault', 1),
    'content' => $chunk
      ->documentLingotekXML(),
    'targetAsJSON' => drupal_json_encode(array_values($target_locales)),
    'note' => url('node/' . $chunk->nid, array(
      'absolute' => TRUE,
      'alias' => TRUE,
    )),
  );
  $this
    ->addAdvancedParameters($parameters, $chunk);
  return $parameters;
}