You are here

function msnf_field_attach_form in Multistep Nodeform 7

Implements hook_field_attach_form().

File

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

Code

function msnf_field_attach_form($entity_type, $entity, &$form, &$form_state, $langcode) {

  // Load steps for this form.
  msnf_attach_steps($form, $form_state);
  if (empty($form['#steps'])) {

    // Nothing to do here.
    return;
  }

  // Init first step if no step is set before.
  if (!isset($form_state['storage']['step'])) {
    $step_names = array_keys($form['#steps']);
    $form_state['storage']['step'] = $step_names[0];
  }

  // If one specific step should be displayed ...
  if (isset($_GET['step'])) {
    $step_requested = filter_xss_admin($_GET['step']);
    _msnf_form_step_set_current($step_requested, $form, $form_state);
  }
}