You are here

public function Form::closingForm in GridStack 8.2

File

src/Plugin/gridstack/stylizer/Form.php, line 53

Class

Form
Provides the form elements.

Namespace

Drupal\gridstack\Plugin\gridstack\stylizer

Code

public function closingForm(array &$form, array $settings) {

  // Allow the current selection to be set in a hidden field so the selection
  // can be passed between different states of the form. This field is filled
  // via JavaScript so the default value should be empty.
  // @see Drupal.behaviors.MediaLibraryItemSelection
  $form['current_selection'] = [
    '#type' => 'hidden',
    '#default_value' => '',
    '#attributes' => [
      'class' => [
        'js-media-library-add-form-current-selection',
      ],
    ],
  ];
  if ($palettes = $this
    ->getColorPalettes()) {
    $form['color_palettes'] = $this
      ->paletteElement($palettes);
    if ($pos = $this
      ->config('palettes_pos')) {
      $form['color_palettes']['#attributes']['class'][] = 'form-wrapper--color-palettes--offset';
      $form['color_palettes']['#attributes']['class'][] = 'form-wrapper--color-palettes--' . $pos;
    }
  }
  if (!$this
    ->config('helpless')) {
    $form['help'] = [];
    $form['help'] = array_merge($form['help'], $this
      ->helpElement());
  }
  $form['#attached']['library'][] = 'gridstack/admin_modal';
  if (!empty($settings['access_media']) && ($library = $this
    ->getMediaLibraryTheme())) {
    $form['#attached']['library'][] = $library;
  }
}