You are here

protected function Form::wrapperForm in GridStack 8.2

1 call to Form::wrapperForm()
Form::buildConfigurationForm in src/Plugin/gridstack/stylizer/Form.php

File

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

Class

Form
Provides the form elements.

Namespace

Drupal\gridstack\Plugin\gridstack\stylizer

Code

protected function wrapperForm($optionset, FormStateInterface $form_state, array $settings, array $extras = []) {
  $element = [];
  $context = $settings['_scope'];
  $desc = $context == GridStackDefault::ROOT ? $this
    ->t('Affecting all. To refine, use region settings.') : '';
  $element['wrappers'] = [
    '#type' => 'details',
    '#open' => FALSE,
    '#tree' => FALSE,
    '#title' => $this
      ->t('Wrappers'),
    '#attributes' => [
      'class' => [
        'form-wrapper--wrappers',
      ],
    ],
  ];
  $element['wrappers'] = array_merge($element['wrappers'], $this
    ->wrapperElement($optionset, $form_state, $settings, $extras));
  $element['preset_classes'] = [
    '#type' => 'details',
    '#open' => FALSE,
    '#tree' => TRUE,
    '#title' => $this
      ->t('Generic preset classes'),
    '#description' => $this
      ->t('Merged with <code>Classes</code> once saved. Leave any color empty for <code>Styles</code> to work.') . ' ' . $desc,
    '#attributes' => [
      'class' => [
        'form-wrapper--preset-classes',
      ],
    ],
    '#region' => $context,
  ];
  $element['preset_classes'] = array_merge($element['preset_classes'], $this
    ->classesElement($optionset, $form_state, $settings, $extras));
  $element['preset_row_classes'] = [
    '#type' => 'details',
    '#open' => FALSE,
    '#tree' => TRUE,
    '#title' => $this
      ->t('Row preset classes'),
    '#description' => $this
      ->t('Merged with <code>Row classes</code> once saved.') . ' ' . $desc,
    '#attributes' => [
      'class' => [
        'form-wrapper--preset-classes',
      ],
    ],
    '#region' => $context,
    '#access' => $optionset
      ->isFramework() && !empty($settings['_container']),
  ];
  $element['preset_row_classes'] = array_merge($element['preset_row_classes'], $this
    ->rowClassesElement($optionset, $form_state, $settings, $extras));
  return $element;
}