You are here

function msnf_attach_steps in Multistep Nodeform 7

Attach steps to the (form) build.

Parameters

<array> $element: The part of the form.

1 call to msnf_attach_steps()
msnf_field_attach_form in ./msnf.module
Implements hook_field_attach_form().

File

./msnf.module, line 898
Main functions for module "Multistep Nodeform".

Code

function msnf_attach_steps(&$element, &$form_state) {
  $entity_type = $element['#entity_type'];
  $bundle = $element['#bundle'];

  // Retrieve step information for this entity type and bundleand attach it to
  // the element.
  $steps = msnf_info_steps($entity_type, $bundle, $element, $form_state);
  $element['#steps'] = _msnf_remove_empty_steps($steps, $element, $form_state);

  // Sort steps by weight.
  uasort($element['#steps'], '_msnf_step_sort');

  // Create a lookup array.
  $step_children = array();
  foreach ($element['#steps'] as $step_name => $step) {
    foreach ($step->children as $child) {
      $step_children[$child] = $step_name;
    }
  }
  $element['#step_children'] = $step_children;

  // Add a pre render callback.
  $element['#pre_render'][] = 'msnf_build_pre_render';
}