You are here

public function Modal::buildConfigurationForm in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/EntityBrowser/Display/Modal.php \Drupal\entity_browser\Plugin\EntityBrowser\Display\Modal::buildConfigurationForm()

Implements PluginFormInterface::buildConfigurationForm().

Overrides IFrame::buildConfigurationForm

File

src/Plugin/EntityBrowser/Display/Modal.php, line 158

Class

Modal
Presents entity browser in an Modal.

Namespace

Drupal\entity_browser\Plugin\EntityBrowser\Display

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
  $configuration = $this
    ->getConfiguration();
  $form = parent::buildConfigurationForm($form, $form_state);
  $form['width'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Width of the modal'),
    '#default_value' => $configuration['width'],
    '#description' => $this
      ->t('Empty value for responsive width.'),
  ];
  $form['height'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Height of the modal'),
    '#default_value' => $configuration['height'],
    '#description' => $this
      ->t('Empty value for responsive height.'),
  ];
  $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;
}