You are here

protected function DialogHelperTrait::dialogSettings in Layout Paragraphs 2.0.x

Returns an array of dialog settings for modal edit forms.

Parameters

\Drupal\layout_paragraphs\LayoutParagraphsLayout|null $layout: If provided, will add a target for the correct dialog id value.

Return value

array The modal settings.

3 calls to DialogHelperTrait::dialogSettings()
ComponentFormController::openForm in src/Controller/ComponentFormController.php
Returns the form, with ajax if appropriate.
LayoutParagraphsBuilder::buildComponent in src/Element/LayoutParagraphsBuilder.php
Returns the build array for a single layout component.
LayoutParagraphsBuilder::insertSectionButton in src/Element/LayoutParagraphsBuilder.php
Returns the render array for a create section button.

File

src/DialogHelperTrait.php, line 61

Class

DialogHelperTrait
Defines a dialog id helper trait.

Namespace

Drupal\layout_paragraphs

Code

protected function dialogSettings(LayoutParagraphsLayout $layout = NULL) {
  $config = \Drupal::config('layout_paragraphs.modal_settings');
  $modal_settings = [
    'width' => $config
      ->get('width'),
    'height' => $config
      ->get('height'),
    'autoResize' => $config
      ->get('autoresize'),
    'modal' => TRUE,
    'drupalAutoButtons' => FALSE,
  ];
  if (!empty($layout)) {
    $modal_settings['target'] = $this
      ->dialogId($layout);
  }
  return $modal_settings;
}