You are here

public static function ArrayHelper::extractNestedValuesToArray in Helper 7

5 calls to ArrayHelper::extractNestedValuesToArray()
ArrayHelperTest::testNestedValue in tests/ArrayHelperTest.test
EntityHelper::getBundleOptions in lib/EntityHelper.php
EntityHelper::getViewModeOptions in lib/EntityHelper.php
FieldHelper::getValues in lib/FieldHelper.php
helper_settings_form in ./helper.admin.inc

File

lib/ArrayHelper.php, line 45

Class

ArrayHelper

Code

public static function extractNestedValuesToArray(array $items, array $value_parents, array $key_parents = NULL) {
  $return = array();
  foreach ($items as $index => $item) {
    $key_exists = FALSE;
    $value = static::getNestedValue($item, $value_parents, $key_exists);
    if ($key_exists) {
      $key = isset($key_parents) ? static::getNestedValue($item, $key_parents, $key_exists) : $index;
      if (!$key_exists || !isset($key)) {
        $key = $index;
      }
      $return[$key] = $value;
    }
  }
  return $return;
}