function drupal_render_children

You are here

7 drupal_render_children(&$element, $children_keys = NULL)
8 drupal_render_children(&$element, $children_keys = NULL)

Renders children of an element and concatenates them.


array $element: The structured array whose children shall be rendered.

array $children_keys: (optional) If the keys of the element's children are already known, they can be passed in to save another run of \Drupal\Core\Render\Element::children().

Return value

string The rendered HTML of all children of the element.

See also


17 calls to drupal_render_children()
theme_file_managed_file in core/modules/file/file.module
Returns HTML for a managed file element.
theme_file_widget in core/modules/file/
Returns HTML for an individual file upload widget.
theme_file_widget_multiple in core/modules/file/
Returns HTML for a group of file upload widgets.
theme_forum_form in core/modules/forum/forum.module
Returns HTML for a forum form.
theme_image_widget in core/modules/image/
Returns HTML for an image field widget.

... See full list


core/includes/, line 3688
Common functions that many Drupal modules will need to reference.


function drupal_render_children(&$element, $children_keys = NULL) {
  if ($children_keys === NULL) {
    $children_keys = Element::children($element);
  $output = '';
  foreach ($children_keys as $key) {
    if (!empty($element[$key])) {
      $output .= drupal_render($element[$key]);
  return $output;