1. drupal
    1. 5
    2. 8
    3. 6
    4. 7
5 – 6 element_children($element)
7 – 8 element_children(&$elements, $sort = FALSE)

Return the children of an element, optionally sorted by weight.


$elements The element to be sorted.

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

Return value

The array keys of the element's children.

▾ 72 functions call element_children()

book_admin_edit_submit in modules/book/book.admin.inc
Handle submission of the book administrative page form.
dashboard_form_block_admin_configure_alter in modules/dashboard/dashboard.module
Implements hook_form_FORM_ID_alter().
dashboard_form_block_admin_display_form_alter in modules/dashboard/dashboard.module
Implements hook_form_FORM_ID_alter().
DrupalRenderTestCase::testDrupalRenderSorting in modules/simpletest/tests/common.test
Test sorting by weight.
drupal_pre_render_links in includes/common.inc
#pre_render callback that collects child links into a single array.
drupal_render in includes/common.inc
Renders HTML given a structured array tree.
drupal_render_children in includes/common.inc
Render children of an element and concatenate them.
drupal_render_collect_attached in includes/common.inc
Collect #attached for an element and all child elements into a single array.
element_get_visible_children in includes/common.inc
Returns the visible children of an element.
field_ui_field_edit_instance_pre_render in modules/field_ui/field_ui.admin.inc
Pre-render function for field instance settings.
field_ui_table_pre_render in modules/field_ui/field_ui.admin.inc
Pre-render callback for field_ui_table elements.
file_field_widget_process in modules/file/file.field.inc
An element #process callback for the file_generic field type.
file_field_widget_process_multiple in modules/file/file.field.inc
An element #process callback for a group of file_generic fields.
filter_process_format in modules/filter/filter.module
Expands an element into a base element with text format selector attached.
FormsTestCase::assertFormValuesDefault in modules/simpletest/tests/form.test
Assert that the values submitted to a form matches the default values of the elements.
FormsTestCase::testDisabledElements in modules/simpletest/tests/form.test
Test handling of disabled elements.
form_builder in includes/form.inc
Walk through the structured form array, adding any required properties to each element and mapping the incoming input data to the proper elements. Also, execute any #process handlers attached to a specific element.
form_pre_render_fieldset in includes/form.inc
Adds members of this group as actual elements for rendering.
forum_overview in modules/forum/forum.admin.inc
Returns an overview list of existing forums and containers
hook_field_attach_view_alter in modules/field/field.api.php
Perform alterations on field_attach_view() or field_view_field().
image_field_widget_form in modules/image/image.field.inc
Implements hook_field_widget_form().
menu_overview_form in modules/menu/menu.admin.inc
Form for editing an entire menu tree at once.
menu_overview_form_submit in modules/menu/menu.admin.inc
Submit handler for the menu overview form.
overlay_page_alter in modules/overlay/overlay.module
Implements hook_page_alter().
profile_admin_overview_submit in modules/profile/profile.admin.inc
Submit handler to update changed profile field weights and categories.
rdf_field_attach_view_alter in modules/rdf/rdf.module
Implements hook_field_attach_view_alter().
render_example_page_alter in examples/render_example/render_example.module
Implements hook_page_alter().
system_modules in modules/system/system.admin.inc
Menu callback; provides module enable/disable interface.
system_theme_settings in modules/system/system.admin.inc
Form builder; display theme configuration for entire site and individual themes.
template_preprocess_block_admin_display_form in modules/block/block.admin.inc
Processes variables for block-admin-display-form.tpl.php.
template_preprocess_book_all_books_block in modules/book/book.module
Process variables for book-all-books-block.tpl.php.
template_preprocess_comment in modules/comment/comment.module
Process variables for comment.tpl.php.
template_preprocess_node in modules/node/node.module
Process variables for node.tpl.php
template_preprocess_search_block_form in modules/search/search.module
Process variables for search-block-form.tpl.php.
template_preprocess_taxonomy_term in modules/taxonomy/taxonomy.module
Process variables for taxonomy-term.tpl.php.
template_preprocess_theming_example_text_form in examples/theming_example/theming_example.module
Implements template_preprocess() to add information to the theming_example_text_form().
template_preprocess_user_profile in modules/user/user.pages.inc
Process variables for user-profile.tpl.php.
theme_aggregator_categorize_items in modules/aggregator/aggregator.pages.inc
Returns HTML for the aggregator page list form for assigning categories.
theme_book_admin_table in modules/book/book.admin.inc
Returns HTML for a book administration form.
theme_color_scheme_form in modules/color/color.module
Returns HTML for a theme's color form.
theme_exposed_filters in modules/system/system.module
Returns HTML for an exposed filter form.
theme_field_multiple_value_form in modules/field/field.form.inc
Returns HTML for an individual form element.
theme_field_ui_table in modules/field_ui/field_ui.admin.inc
Returns HTML for Field UI overview tables.
theme_file_widget_multiple in modules/file/file.field.inc
Returns HTML for a group of file upload widgets.
theme_filter_admin_format_filter_order in modules/filter/filter.admin.inc
Returns HTML for a text format's filter order form.
theme_filter_admin_overview in modules/filter/filter.admin.inc
Returns HTML for the text format administration overview form.
theme_image_anchor in modules/image/image.admin.inc
Returns HTML for a 3x3 grid of checkboxes for image anchors.
theme_image_style_effects in modules/image/image.admin.inc
Returns HTML for a listing of the effects within a specific image style.
theme_locale_date_format_form in modules/locale/locale.admin.inc
Returns HTML for a locale date format form.
theme_menu_overview_form in modules/menu/menu.admin.inc
Returns HTML for the menu overview form into a table.
theme_node_search_admin in modules/node/node.module
Returns HTML for the content ranking part of the search settings admin page.
theme_poll_choices in modules/poll/poll.module
Returns HTML for an admin poll form for choices.
theme_profile_admin_overview in modules/profile/profile.admin.inc
Returns HTML for the profile field overview form into a drag and drop enabled table.
theme_render_example_aggregate in examples/render_example/render_example.module
A #theme function.
theme_shortcut_set_customize in modules/shortcut/shortcut.admin.inc
Returns HTML for a shortcut set customization form.
theme_simpletest_test_table in modules/simpletest/simpletest.pages.inc
Returns HTML for a test list generated by simpletest_test_form() into a table.
theme_system_date_time_settings in modules/system/system.admin.inc
Returns HTML for the date settings form.
theme_system_modules_fieldset in modules/system/system.admin.inc
Returns HTML for the modules form.
theme_system_modules_uninstall in modules/system/system.admin.inc
Returns HTML for a table of currently disabled modules.
theme_tableselect in includes/form.inc
Returns HTML for a table with radio buttons or checkboxes.
theme_taxonomy_overview_terms in modules/taxonomy/taxonomy.admin.inc
Returns HTML for a terms overview form as a sortable list of terms.
theme_taxonomy_overview_vocabularies in modules/taxonomy/taxonomy.admin.inc
Returns HTML for the vocabulary overview form as a sortable list of vocabularies.
theme_theming_example_content_array in examples/theming_example/theming_example.module
Theme a simple content array.
theme_user_admin_permissions in modules/user/user.admin.inc
Returns HTML for the administer permissions page.
theme_user_admin_roles in modules/user/user.admin.inc
Returns HTML for the role order and new role form.
user_admin_settings in modules/user/user.admin.inc
Form builder; Configure user settings for this site.
user_cancel_confirm_form in modules/user/user.pages.inc
Form builder; confirm form for cancelling user account.
user_multiple_cancel_confirm in modules/user/user.module
_authorize_filetransfer_connection_settings_set_defaults in includes/authorize.inc
Recursively fill in the default settings on a file transfer connection form.
_color_theme_select_form_alter in modules/color/color.module
Helper for hook_form_FORM_ID_alter() implementations.
_form_validate in includes/form.inc
Performs validation on form elements. First ensures required fields are completed, #maxlength is not exceeded, and selected options were in the list of options given to the user. Then calls user-defined validators.
_simpletest_batch_operation in modules/simpletest/simpletest.module
Batch operation callback.


includes/common.inc, line 6138

function element_children(&$elements, $sort = FALSE) {
  // Do not attempt to sort elements which have already been sorted.
  $sort = isset($elements['#sorted']) ? !$elements['#sorted'] : $sort;

  // Filter out properties from the element, leaving only children.
  $children = array();
  $sortable = FALSE;
  foreach ($elements as $key => $value) {
    if ($key === '' || $key[0] !== '#') {
      $children[$key] = $value;
      if (is_array($value) && isset($value['#weight'])) {
        $sortable = TRUE;
  // Sort the children if necessary.
  if ($sort && $sortable) {
    uasort($children, 'element_sort');
    // Put the sorted children back into $elements in the correct order, to
    // preserve sorting if the same element is passed through
    // element_children() twice.
    foreach ($children as $key => $child) {
      $elements[$key] = $child;
    $elements['#sorted'] = TRUE;

  return array_keys($children);