You are here

public function SettingsForm::buildForm in Lightning Media 8.3

Same name and namespace in other branches
  1. 8.4 src/Form/SettingsForm.php \Drupal\lightning_media\Form\SettingsForm::buildForm()
  2. 8 src/Form/SettingsForm.php \Drupal\lightning_media\Form\SettingsForm::buildForm()
  3. 8.2 src/Form/SettingsForm.php \Drupal\lightning_media\Form\SettingsForm::buildForm()

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/SettingsForm.php, line 47

Class

SettingsForm
The settings form for controlling Lightning Media's behavior.

Namespace

Drupal\lightning_media\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $settings = $this
    ->config('lightning_media.settings');
  $form['choose_display'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Allow users to choose how to display embedded media'),
    '#default_value' => $settings
      ->get('entity_embed.choose_display'),
  ];
  $form['override_widget'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Override the default widget of media reference fields'),
    '#default_value' => $settings
      ->get('entity_browser.override_widget'),
  ];
  $form['revision_ui'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Show revision UI on media forms'),
    '#default_value' => $settings
      ->get('revision_ui'),
  ];
  return parent::buildForm($form, $form_state);
}