public static function ArrayHelper::extractNestedValuesToArray in Helper 7
5 calls to ArrayHelper::extractNestedValuesToArray()
File
- lib/
ArrayHelper.php, line 45
Class
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;
}