rebuildForm example

    $input = $form_state->getUserInput();
    if (!isset($input)) {
      $input = $form_state->isMethodType('get') ? $request->query->all() : $request->request->all();
      $form_state->setUserInput($input);
    }

    if (isset($_SESSION['batch_form_state'])) {
      // We've been redirected here after a batch processing. The form has       // already been processed, but needs to be rebuilt. See _batch_finished().       $form_state = $_SESSION['batch_form_state'];
      unset($_SESSION['batch_form_state']);
      return $this->rebuildForm($form_id$form_state);
    }

    // If the incoming input contains a form_build_id, we'll check the cache for     // a copy of the form in question. If it's there, we don't have to rebuild     // the form to proceed. In addition, if there is stored form_state data from     // a previous step, we'll retrieve it so it can be passed on to the form     // processing code.     $check_cache = isset($input['form_id']) && $input['form_id'] == $form_id && !empty($input['form_build_id']);
    if ($check_cache) {
      $form = $this->getCache($input['form_build_id']$form_state);
    }

    
Home | Imprint | This part of the site doesn't use cookies.