public function TwigExtension::children in Twig Tweak 8.2
Filters out the children of a render array, optionally sorted by weight.
Parameters
array $build: The render array whose children are to be filtered.
bool $sort: Boolean to indicate whether the children should be sorted by weight.
Return value
array The element's children.
File
- src/
TwigExtension.php, line 1220
Class
- TwigExtension
- Twig extension with some useful functions and filters.
Namespace
Drupal\twig_tweakCode
public function children(array $build, $sort = FALSE) {
$keys = Element::children($build, $sort);
return array_intersect_key($build, array_flip($keys));
}