You are here

public function TMGMTJobItem::getData in Translation Management Tool 7

Array of the data to be translated.

The structure is similar to the form API in the way that it is a possibly nested array with the following properties whose presence indicate that the current element is a text that might need to be translated.

  • #text: The text to be translated.
  • #label: (Optional) The label that might be shown to the translator.
  • #comment: (Optional) A comment with additional information.
  • #translate: (Optional) If set to FALSE the text will not be translated.
  • #translation: The translated data. Set by the translator plugin.
  • #escape: (Optional) List of arrays with a required string key, keyed by the position key. Translators must use this list to prevent translation of these strings if possible.

@todo: Move data item documentation to a new, separate api group.

The key can be an alphanumeric string.

Parameters

$key: If present, only the subarray identified by key is returned.

$index: Optional index of an attribute below $key.

Return value

array A structured data array.

3 calls to TMGMTJobItem::getData()
TMGMTJobItem::addTranslatedData in entity/tmgmt.entity.job_item.inc
Adds translated data to a job item.
TMGMTJobItem::addTranslatedDataRecursive in entity/tmgmt.entity.job_item.inc
Recursively writes translated data to the data array of a job item.
TMGMTJobItem::dataItemRevert in entity/tmgmt.entity.job_item.inc
Reverts data item translation to the latest existing revision.

File

entity/tmgmt.entity.job_item.inc, line 315

Class

TMGMTJobItem
Entity class for the tmgmt_job entity.

Code

public function getData(array $key = array(), $index = NULL) {
  if (empty($this->data) && !empty($this->tjid)) {

    // Load the data from the source if it has not been set yet.
    $this->data = $this
      ->getSourceData();
    $this
      ->save();
  }
  if (empty($key)) {
    return $this->data;
  }
  if ($index) {
    $key = array_merge($key, array(
      $index,
    ));
  }
  return drupal_array_get_nested_value($this->data, $key);
}