You are here

public function FileAddForm::buildForm in File Entity (fieldable files) 8.2

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides FormInterface::buildForm

File

src/Form/FileAddForm.php, line 92

Class

FileAddForm
Form controller for file type forms.

Namespace

Drupal\file_entity\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, array $options = array()) {
  $step = in_array($form_state
    ->get('step'), array(
    1,
    2,
    3,
    4,
  )) ? $form_state
    ->get('step') : 1;
  $form_state
    ->set('step', $step);
  $form_state
    ->set('options', $options);
  switch ($step) {
    case 1:
      return $this
        ->stepUpload($form, $form_state, $options);
    case 2:
      return $this
        ->stepFileType($form, $form_state);
    case 3:
      return $this
        ->stepScheme($form, $form_state);
    case 4:
      return $this
        ->stepFields($form, $form_state);
  }
  return FALSE;
}