You are here

public function Bootstrap4Modal::buildConfigurationForm in Bootstrap 4 Modal 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/EntityBrowser/Display/Bootstrap4Modal.php \Drupal\bootstrap4_modal\Plugin\EntityBrowser\Display\Bootstrap4Modal::buildConfigurationForm()

File

src/Plugin/EntityBrowser/Display/Bootstrap4Modal.php, line 169

Class

Bootstrap4Modal
Presents entity browser in an Modal.

Namespace

Drupal\bootstrap4_modal\Plugin\EntityBrowser\Display

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
  $configuration = $this
    ->getConfiguration();
  $form = parent::buildConfigurationForm($form, $form_state);
  unset($form['width']);
  unset($form['height']);
  $form['modal_size'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Width of the modal'),
    '#default_value' => isset($configuration['modal_size']) ? $configuration['modal_size'] : NULL,
    '#options' => [
      'modal-sm' => $this
        ->t('Small'),
      '' => $this
        ->t('Default'),
      'modal-lg' => $this
        ->t('Large'),
      'modal-xl' => $this
        ->t('Extra large'),
    ],
  ];
  $form['auto_open']['#description'] = $this
    ->t('Will open Entity browser modal as soon as page is loaded, which might cause unwanted results. Should be used only in very specific cases such as Inline entity form integration. It is also advised not to use Entity browsers with this option enabled more than once per page.');
  return $form;
}