You are here

public function EmbedSettingsForm::buildForm in Embed 8

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 ConfigFormBase::buildForm

File

src/Form/EmbedSettingsForm.php, line 64

Class

EmbedSettingsForm
Configure embed settings for this site.

Namespace

Drupal\embed\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('embed.settings');
  $scheme_options = $this->streamWrapperManager
    ->getNames(StreamWrapperInterface::WRITE_VISIBLE);
  $form['file_scheme'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Upload destination'),
    '#options' => $scheme_options,
    '#default_value' => $config
      ->get('file_scheme'),
    '#description' => $this
      ->t('Select where the uploaded button icon files should be stored.'),
  ];
  $form['upload_directory'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('File directory'),
    '#default_value' => $config
      ->get('upload_directory'),
    '#description' => $this
      ->t('Optional subdirectory within the upload destination where files will be stored. Do not include preceding or trailing slashes.'),
    '#element_validate' => [
      [
        get_class($this),
        'validateDirectory',
      ],
    ],
  ];
  return parent::buildForm($form, $form_state);
}