public static function ArrayHelper::filterByNestedValue in Helper 7
1 call to ArrayHelper::filterByNestedValue()
File
- lib/
ArrayHelper.php, line 28
Class
Code
public static function filterByNestedValue(array $items, array $parents, $value) {
$return = array();
foreach ($items as $key => $item) {
$key_exists = FALSE;
$found_value = static::getNestedValue($item, $parents, $key_exists);
if ($key_exists) {
if (is_array($value) && in_array($found_value, $value)) {
$return[$key] = $item;
}
elseif ($found_value == $value) {
$return[$key] = $item;
}
}
}
return $return;
}