public static function TwigSanitize::removeEmpty in Twig Tools 8
Removes all falsy values from an array.
Parameters
array $array: The array to remove empty/falsy values from.
Return value
array A new array with only non-empty/non-falsy values.
1 call to TwigSanitize::removeEmpty()
- TwigSanitize::scrubClassArray in src/
TwigExtension/ TwigSanitize.php - Runs array through all of the Twig Tools sanitization filters.
File
- src/
TwigExtension/ TwigSanitize.php, line 69
Class
- TwigSanitize
- Class TwigSanitize.
Namespace
Drupal\twig_tools\TwigExtensionCode
public static function removeEmpty(array $array) {
return array_merge([], array_filter($array));
}