You are here

protected function GridStackFormBase::breakpointElements in GridStack 8.2

Defines breakpoints form adopted from Blazy deprecated methods.

We add custom classes to support various admin themes where applicable.

1 call to GridStackFormBase::breakpointElements()
GridStackForm::previewForm in modules/gridstack_ui/src/Form/GridStackForm.php
Sets up the preview form.

File

modules/gridstack_ui/src/Form/GridStackFormBase.php, line 942

Class

GridStackFormBase
Extends base form for gridstack instance configuration form.

Namespace

Drupal\gridstack_ui\Form

Code

protected function breakpointElements() {
  $form = [];
  foreach ($this
    ->getApplicableBreakpoints() as $breakpoint) {
    $form[$breakpoint]['breakpoint'] = [
      '#type' => 'markup',
      '#markup' => $breakpoint,
      '#weight' => 1,
      '#wrapper_attributes' => [
        'class' => [
          'form-item--right',
        ],
      ],
      '#access' => !$this->useNested,
    ];
    $form[$breakpoint]['width'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Width'),
      '#title_display' => 'invisible',
      '#description' => $this
        ->t('See <strong>XS</strong> for detailed info.'),
      '#max_length' => 32,
      '#size' => 6,
      '#weight' => 3,
      '#attributes' => [
        'class' => [
          'form-text--width',
        ],
      ],
      '#wrapper_attributes' => [
        'class' => [
          'form-item--width',
        ],
      ],
      '#disabled' => $this->isVariant,
    ];
  }
  return $form;
}