You are here

function _webform_components_tree_build in Webform 7.4

Same name and namespace in other branches
  1. 5.2 webform.module \_webform_components_tree_build()
  2. 5 webform.module \_webform_components_tree_build()
  3. 6.3 webform.module \_webform_components_tree_build()
  4. 6.2 webform.module \_webform_components_tree_build()
  5. 7.3 webform.module \_webform_components_tree_build()

Convert an array of components into a tree.

4 calls to _webform_components_tree_build()
template_preprocess_webform_components_form in includes/webform.components.inc
Preprocess variables for theming the webform components form.
webform_client_form in ./webform.module
Client form generation function.
webform_node_load in ./webform.module
Implements hook_node_load().
webform_submission_render in includes/webform.submissions.inc
Prepare a Webform submission for display on a page or in an e-mail.

File

./webform.module, line 4823
This module provides a simple way to create forms and questionnaires.

Code

function _webform_components_tree_build($src, &$tree, $parent, &$page_count) {
  foreach ($src as $cid => $component) {
    if ($component['pid'] == $parent) {
      _webform_components_tree_build($src, $component, $cid, $page_count);
      if ($component['type'] == 'pagebreak') {
        $page_count++;
      }
      $tree['children'][$cid] = $component;
      $tree['children'][$cid]['page_num'] = $page_count;
    }
  }
  return $tree;
}