public function Data::unflatten

Converts a flattened data structure into a nested array.

This function can be used by translators to help with the data conversion.

Nested keys will be created based on the colon, so for example $flattened_data['key1][key2][key3'] will be converted into $data['key1']['key2']['key3'].

Parameters

array $flattened_data: The flattened data array.

Return value

array The nested data array.

File

src/Data.php, line 93

Class

Data
All data-related functions.

Namespace

Drupal\tmgmt

Code

public function unflatten(array $flattened_data) {
  $data = array();
  foreach ($flattened_data as $key => $flattened_data_entry) {
    NestedArray::setValue($data, explode(static::TMGMT_ARRAY_DELIMITER, $key), $flattened_data_entry);
  }
  return $data;
}