You are here

function FileAddForm::stepFields in File Entity (fieldable files) 8.2

Step 4

_state

Parameters

$form:

1 call to FileAddForm::stepFields()
FileAddForm::buildForm in src/Form/FileAddForm.php
Form constructor.

File

src/Form/FileAddForm.php, line 292

Class

FileAddForm
Form controller for file type forms.

Namespace

Drupal\file_entity\Form

Code

function stepFields(array $form, FormStateInterface $form_state) {

  // Load the file and overwrite the filetype set on the previous screen.

  /** @var \Drupal\file\FileInterface$file*/
  $file = $form_state
    ->get('file');
  $form_state
    ->set('form_display', EntityFormDisplay::collectRenderDisplay($file, 'default'));
  $form_state
    ->get('form_display')
    ->buildForm($file, $form, $form_state);
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['previous'] = array(
    '#type' => 'submit',
    '#value' => t('Previous'),
    '#limit_validation_errors' => array(),
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#button_type' => 'primary',
    '#value' => t('Save'),
  );
  return $form;
}