function drupal_render_children

You are here

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

Renders children of an element and concatenates them.

Parameters

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

drupal_render()

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/file.field.inc
Returns HTML for an individual file upload widget.
theme_file_widget_multiple in core/modules/file/file.field.inc
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/image.field.inc
Returns HTML for an image field widget.

... See full list

File

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

Code

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;
}