public function LocalTaskItem::getData

Gets translation data.

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 translated text of the corresponding entry in the job item.
  • #status: The status of the translation.

The key can be an alphanumeric string.

Parameters

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

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

Return value

array A structured data array.

Overrides LocalTaskItemInterface::getData

File

translators/tmgmt_local/src/Entity/LocalTaskItem.php, line 205

Class

LocalTaskItem
Entity class for the local task item entity.

Namespace

Drupal\tmgmt_local\Entity

Code

public function getData($key = array(), $index = NULL) {
  $this
    ->decodeData();
  if (empty($this->unserializedData) && $this
    ->getTask()) {

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