You are here

protected function InsertFileTestBase::flatten in Insert 8.2

Parameters

array $array:

string (optional) $prefix:

Return value

array

1 call to InsertFileTestBase::flatten()
InsertFileTestBase::settingsToParams in tests/src/FunctionalJavaScript/InsertFileTestBase.php

File

tests/src/FunctionalJavaScript/InsertFileTestBase.php, line 129

Class

InsertFileTestBase

Namespace

Drupal\Tests\insert\FunctionalJavascript

Code

protected function flatten(array $array, $prefix = '') {
  $result = [];
  foreach ($array as $key => $value) {
    if (is_array($value)) {
      $result = $result + $this
        ->flatten($value, $prefix . "[{$key}]");
    }
    else {
      $result[$prefix . "[{$key}]"] = $value;
    }
  }
  return $result;
}