function public function Element::children

8.x-3.x Element.php public Element::children($sort = FALSE)

Retrieves the children of an element array, optionally sorted by weight.

The children of a element array are those key/value pairs whose key does not start with a '#'. See drupal_render() for details.

Parameters

bool $sort: Boolean to indicate whether the children should be sorted by weight.

Return value

\Drupal\bootstrap\Utility\Element[] An array child elements.

Class

Element
Provides helper methods for Drupal render elements.

Namespace

Drupal\bootstrap\Utility

Source src/Utility/Element.php (line 207)

public function children($sort = FALSE) {
  $children = [];
  foreach ($this->childKeys($sort) as $child) {
    $children[$child] = new self($this->array[$child]);
  }
  return $children;
}