You are here

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

Form Step 3

_state

Parameters

$form:

Return value

mixed

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

File

src/Form/FileAddForm.php, line 257

Class

FileAddForm
Form controller for file type forms.

Namespace

Drupal\file_entity\Form

Code

function stepScheme(array $form, FormStateInterface $form_state) {
  $options = array();
  foreach (\Drupal::service('stream_wrapper_manager')
    ->getDescriptions(StreamWrapperInterface::WRITE_VISIBLE) as $scheme => $description) {
    $options[$scheme] = Html::escape($description);
  }
  $form['scheme'] = array(
    '#type' => 'radios',
    '#title' => t('Destination'),
    '#options' => $options,
    '#default_value' => $form_state
      ->get('scheme') ?: $this
      ->config('system.file')
      ->get('default_scheme'),
    '#required' => TRUE,
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['previous'] = array(
    '#type' => 'submit',
    '#value' => t('Previous'),
    '#limit_validation_errors' => array(),
  );
  $form['actions']['next'] = array(
    '#type' => 'submit',
    '#button_type' => 'primary',
    '#value' => t('Next'),
  );
  return $form;
}