Update to Drupal 8.0.6. For more information, see https://www.drupal.org/drupal-8.0.6-release-notes
This commit is contained in:
parent
4297c64508
commit
b11a755ba8
159 changed files with 2340 additions and 543 deletions
|
@ -349,4 +349,26 @@ class NestedArray {
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters a nested array recursively.
|
||||
*
|
||||
* @param array $array
|
||||
* The filtered nested array.
|
||||
* @param callable|NULL $callable
|
||||
* The callable to apply for filtering.
|
||||
*
|
||||
* @return array
|
||||
* The filtered array.
|
||||
*/
|
||||
public static function filter(array $array, callable $callable = NULL) {
|
||||
$array = is_callable($callable) ? array_filter($array, $callable) : array_filter($array);
|
||||
foreach ($array as &$element) {
|
||||
if (is_array($element)) {
|
||||
$element = static::filter($element, $callable);
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue