You are here

function tmgmt_ensure_keys_array in Translation Management Tool 7

Converts string keys to array keys.

There are three conventions for data keys in use. This function accepts each of it an ensures a array of keys.

Parameters

$key: The key can be either be an array containing the keys of a nested array hierarchy path or a string with '][' or '|' as delimiter.

Return value

Array of keys.

10 calls to tmgmt_ensure_keys_array()
TMGMTFileformatXLIFF::addTransUnit in translators/file/tmgmt_file.format.xliff.inc
Adds a single translation unit for a data element.
TMGMTFileformatXLIFF::validateImport in translators/file/tmgmt_file.format.xliff.inc
Validates that the given file is valid and can be imported.
TMGMTJob::addTranslatedData in entity/tmgmt.entity.job.inc
Store translated data back into the items.
TMGMTJobItem::addTranslatedDataRecursive in entity/tmgmt.entity.job_item.inc
Recursively writes translated data to the data array of a job item.
TMGMTJobItem::updateData in entity/tmgmt.entity.job_item.inc
Updates the values for a specific substructure in the data array.

... See full list

File

./tmgmt.module, line 1364
Main module file for the Translation Management module.

Code

function tmgmt_ensure_keys_array($key) {
  if (empty($key)) {
    return array();
  }
  if (!is_array($key)) {
    if (strstr($key, '|')) {
      $key = str_replace('|', TMGMT_ARRAY_DELIMITER, $key);
    }
    $key = explode(TMGMT_ARRAY_DELIMITER, $key);
  }
  return $key;
}