You are here

class GridStackForm in GridStack 8.2

Same name and namespace in other branches
  1. 8 modules/gridstack_ui/src/Form/GridStackForm.php \Drupal\gridstack_ui\Form\GridStackForm

Extends base form for gridstack instance configuration form.

Hierarchy

Expanded class hierarchy of GridStackForm

2 files declare their use of GridStackForm
GridStackFormUnitTest.php in tests/src/Unit/Form/GridStackFormUnitTest.php
GridStackManagerTest.php in tests/src/Kernel/GridStackManagerTest.php

File

modules/gridstack_ui/src/Form/GridStackForm.php, line 12

Namespace

Drupal\gridstack_ui\Form
View source
class GridStackForm extends GridStackFormBase {

  /**
   * {@inheritdoc}
   */
  public function form(array $form, FormStateInterface $form_state) {
    $form = parent::form($form, $form_state);
    $this
      ->optionsForm($form, $form_state);
    $this
      ->settingsForm($form, $form_state);
    $this
      ->previewForm($form, $form_state);
    if (!$this->useNested) {
      $this
        ->massageSettings($form);
    }
    return $form;
  }

  /**
   * Returns form item description.
   */
  protected function getDescription($key) {
    $url1 = Url::fromRoute('gridstack.settings')
      ->toString();
    $url2 = 'https://gridstackjs.com/demo/float.html';
    $url3 = 'https://gridstackjs.com/demo/rtl.html';
    $description = [
      'use_framework' => $this
        ->t("If you don't clone the provided Bootstrap/Foundation default, be sure to save the form first before working to set things up correctly. Check to enable static grid framework (Bootstrap/Foundation). Uncheck to use native CSS Grid, or JS layout. Must enable the support <a href=':url'>here</a> first. This requires basic comprehension on how a static grid like Bootstrap, or Foundation, works. And GridStack preview limitation. Basically on how columns and rows build up the grid system. Failing to understand it may result in broken grids (this is no issue if using GridStack JS, unchecked).<br>If checked: <ul><li>No GridStack JS/ CSS assets are loaded at front-end.</li><li>Must have a theme, or module, that loads Bootstrap/ Foundation CSS for you.</li><li>No fixed height, just auto height. Repeat, height is ignored.</li><li>Boxes are floating like normal CSS floats, no longer absolutely positioned. The previews may trick you, bear with it.</li><li>No longer a fixed-height magazine layout. Just a normal floating CSS grid layout.</li><li>This layout is only available for core <strong>Layout Builder, DS, Panelizer, or Widget</strong> modules. Leave it unchecked if not using them, else useless for GridStack alone.</li></ul>Clone an existing Default Bootstrap/ Foundation optionset to begin with. Limitation: pull, push classes are not supported, yet.", [
        ':url' => $url1,
      ]),
      'settings' => $this
        ->t('This only affects GridStack JS and native CSS Grid, not Bootstrap/ Foundation. Only few are applicable for native Grid: Min width, Cell height, margins, and columns.'),
      'auto' => $this
        ->t("If unchecked, gridstack will not initialize existing items, means broken."),
      'cellHeight' => $this
        ->t("One cell height. <strong>0</strong> means the library will not generate styles for rows. Everything must be defined in CSS files. <strong>auto (-1)</strong> means height will be calculated from cell width. Default 60. Be aware, auto has issues with responsive displays. Put <strong>-1</strong> if you want <strong>auto</strong> as this is an integer type."),
      'float' => $this
        ->t("Enable floating widgets. See <a href=':url'>float sample</a>. Default FALSE.", [
        ':url' => $url2,
      ]),
      'minWidth' => $this
        ->t('If window width is less, grid will be shown in one-column mode, with added class: <strong>grid-stack-1</strong>. Recommended the same as or less than XS below, if provided. Default 768.'),
      'main_column' => $this
        ->t('The amount of columns. <strong>Important!</strong> This desktop column is overridden and ignored by LG/XL below if provided.'),
      'maxRow' => $this
        ->t("Maximum rows amount. Default is <strong>0</strong> which means no maximum rows."),
      'rtl' => $this
        ->t("If <strong>true</strong> turns grid to RTL. Possible values are <strong>true</strong>, <strong>false</strong>, <strong>auto</strong> -- default. See <a href=':url'>RTL</a>.", [
        ':url' => $url3,
      ]),
      'verticalMargin' => $this
        ->t("Vertical gap size. Default 20."),
      'noMargin' => $this
        ->t('If checked, be sure to put 0 for Vertical margin to avoid improper spaces.'),
      'breakpoints' => $this
        ->t('Responsive multi-breakpoint grids<small><span class="visible-js">XS is expected for disabled state defined by <strong>Min width</strong>.<br>The column will be updated at the given breakpoint. <br>Fooled not by incorrect aspect ratios. Trust the numbers in dark.</span><span class="visible-css"><strong>Note!</strong> If using static Bootstrap/ Foundation grid, this is a normal min-width, or mobile first layout. <br>Height is determined by the actual content. Here is just illustration to make nice icon.</span><br>If the layout is messed up for some reason, simply save and edit it back. It should re-arrange and correct the indices after saving. <br>Input relevant breakpoint value for the <b>Width</b> option below to make it editable, empty means disabled (non-editable).</small>'),
      'column' => $this
        ->t('The minimum column for this breakpoint. Try changing this if some grid/box is accidentally hidden to bring them back into the viewport. <br><strong>Important!</strong> This must be 12 if using static Bootstrap/ Foundation. Avoid odd number, else headaches. Column is the best way to make <b>native CSS Grid</b> responsive.'),
      'column_icon' => $this
        ->t('Once provided, this will override the <strong>Amount of columns</strong> option above. Update the <strong>Amount of columns</strong> to match this new value if confused.'),
      'lg' => $this
        ->t('<small><span class="visible-js">Grids are managed at the topmost settings. </span>This breakpoint is to generate icon. Best with total rows at maximum 16.</small>'),
      'sm' => $this
        ->t('<small>Grids are in one column mode here, disabled. Best height is 1x1 or 1x2 at most, else absurd.</small>'),
      'width' => $this
        ->t('For static Bootstrap/Foundation, it only affects this very admin page for preview. The actual breakpoint is already defined by their CSS. Adjust it for correct preview.<ul><li>For GridStack JS, the minimum value must be <strong>&gt;= Min width</strong> above.</li><li>EM to PX conversion is based on 16px base font-size:<br>Bootstrap 3:<br><strong>SM >= 768px, MD >= 992px, LG >= 1200px</strong><br>Bootstrap 4: <br><strong>XS < 576px, SM >= 576px, MD >= 768px, LG >= 992px, XL >= 1200px</strong><br>Foundation:<br><strong>SM >= 0px, MD >= 641px (40.063em), LG >= 1025px (64.063em)</strong></li></ul>Leave it empty to disable/ ignore this breakpoint. <br><strong>Tips:</strong> Temporarily increase this to 768+ if trouble to expand shrinked boxes. Input relevant breakpoint value to make it editable.'),
    ];
    return isset($description[$key]) ? $description[$key] : NULL;
  }

  /**
   * Sets up the options form.
   */
  protected function optionsForm(array &$form, FormStateInterface $form_state) {
    $classes = [
      'details--settings',
      'has-tooltip',
    ];
    $form['options'] = [
      '#type' => 'container',
      '#tree' => TRUE,
      '#title' => $this
        ->t('Options'),
      '#title_display' => 'invisible',
      '#attributes' => [
        'class' => $classes,
        'id' => 'edit-options',
      ],
      '#access' => $this
        ->gridStack()
        ->id() == 'default' ? FALSE : TRUE,
    ];
    $form['options']['icon'] = [
      '#type' => 'hidden',
      '#default_value' => isset($this->options['icon']) ? $this->options['icon'] : '',
      '#attributes' => [
        'id' => 'gridstack-icon',
        'data-url' => $this->entity
          ->getIconUrl(TRUE),
      ],
    ];
    $form['options']['use_framework'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Use static <span>@framework</span>', [
        '@framework' => $this->framework,
      ]),
      '#default_value' => $this
        ->gridStack()
        ->getOption('use_framework'),
      '#description' => $this
        ->getDescription('use_framework'),
      '#wrapper_attributes' => [
        'class' => [
          'form-item--options-use-framework',
          'form-item--tooltip-bottom',
        ],
      ],
      '#disabled' => $this->useNested,
    ];
    if ($this->adminCss) {
      $form['options']['use_framework']['#field_suffix'] = '&nbsp;';
      $form['options']['use_framework']['#title_display'] = 'before';
    }
  }

  /**
   * Sets up the settings form.
   */
  protected function settingsForm(array &$form, FormStateInterface $form_state) {
    $states['visible'][':input[name*="[staticGrid]"]'] = [
      'checked' => FALSE,
    ];
    $form['options']['settings'] = [
      '#type' => 'details',
      '#tree' => TRUE,
      '#open' => FALSE,
      '#title' => $this
        ->t('GridStack JS or Native Grid Settings'),
      '#description' => $this
        ->getDescription('settings'),
      '#attributes' => [
        'class' => [
          'form-wrapper--gridstack-settings',
        ],
      ],
      '#access' => !$this->useNested,
    ];
    $form['options']['settings']['auto'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Auto'),
      '#description' => $this
        ->getDescription('auto'),
    ];
    $form['options']['settings']['cellHeight'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Cell height'),
      '#description' => $this
        ->getDescription('cellHeight'),
    ];
    $form['options']['settings']['float'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Float'),
      '#description' => $this
        ->getDescription('float'),
      '#states' => $states,
    ];
    $form['options']['settings']['minWidth'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Min width'),
      '#field_suffix' => 'px',
      '#description' => $this
        ->getDescription('minWidth'),
    ];
    $form['options']['settings']['column'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Amount of columns'),
      '#options' => $this
        ->getColumnOptions(),
      '#attributes' => [
        'class' => [
          'form-select--column',
        ],
        'data-target' => '#gridstack-' . $this->iconBreakpoint,
      ],
      '#description' => $this
        ->getDescription('main_column'),
    ];
    $form['options']['settings']['maxRow'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Maximum rows'),
      '#field_suffix' => 'px',
      '#description' => $this
        ->getDescription('maxRow'),
    ];
    $form['options']['settings']['rtl'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('RTL'),
      '#description' => $this
        ->getDescription('rtl'),
    ];
    $form['options']['settings']['verticalMargin'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Vertical margin'),
      '#field_suffix' => 'px',
      '#description' => $this
        ->getDescription('verticalMargin'),
    ];
    $form['options']['settings']['noMargin'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('No horizontal margin'),
      '#description' => $this
        ->getDescription('noMargin'),
    ];

    // @todo use <b>Revert</b> button to the last saved states, or
    $form['options']['breakpoints'] = [
      '#type' => 'vertical_tabs',
      '#tree' => TRUE,
      '#group' => 'breakpoints',
      '#parents' => [
        'breakpoints',
      ],
      '#default_tab' => 'edit-options-breakpoints-' . $this->iconBreakpoint,
      '#prefix' => $this->isVariant ? '' : '<h2 class="form__title form__title--responsive">' . $this
        ->getDescription('breakpoints') . '</h2>',
      '#attributes' => [
        'class' => [
          'vertical-tabs__edit-breakpoints',
        ],
        'id' => 'edit-options-breakpoints',
      ],
    ];
  }

  /**
   * Sets up the preview form.
   */
  protected function previewForm(array &$form, FormStateInterface $form_state) {
    $nodes = [
      'autoPosition' => TRUE,
      'maxHeight' => 60,
      'minHeight' => 1,
      'defaultMinWidth' => 2,
      'defaultMinHeight' => 2,
      'rootMinWidth' => 1,
      'nestedMinWidth' => 2,
    ];
    $gridstack = $this
      ->gridStack();
    foreach ($this
      ->breakpointElements() as $column => $elements) {
      $storage = 'edit-options-breakpoints-' . $column . '-grids';
      $nested_storage = 'edit-options-breakpoints-' . $column . '-nested';
      $columns = isset($this->options['breakpoints'], $this->options['breakpoints'][$column]) ? $this->options['breakpoints'][$column] : [];

      // Fallbacks to source for variants.
      if ($this->isVariant && empty($columns) && $gridstack) {
        $breakpoints = $gridstack
          ->getOptions('breakpoints');
        if (isset($breakpoints[$column])) {
          $columns = $breakpoints[$column];
        }
      }
      $active_column = isset($columns['column']) ? $columns['column'] : 12;
      $active_width = isset($columns['width']) ? $columns['width'] : '';

      // $active_column === -1 ? 'auto' : $active_column;
      if ($this->useNested) {
        $active_column = 12;
      }

      // Details.
      $form[$column]['#type'] = $this->isDefault ? 'container' : 'details';
      $form[$column]['#tree'] = TRUE;
      $form[$column]['#open'] = TRUE;
      $form[$column]['#group'] = 'breakpoints';
      $form[$column]['#parents'] = [
        'options',
        'breakpoints',
        $column,
      ];
      $form[$column]['#title'] = $column;

      // Prevents AJAX from adding unique ID, since we have limited known ones.
      $form[$column]['#attributes']['id'] = 'edit-options-breakpoints-' . $column;

      // Settings.
      $this->jsSettings['breakpoint'] = $column;
      $this->jsSettings['display'] = 'responsive';
      $this->jsSettings['storage'] = $storage;
      $this->jsSettings['nested_storage'] = $nested_storage;
      $this->jsSettings['icon_breakpoint'] = $this->iconBreakpoint;
      $this->jsSettings['breakpoint_width'] = $active_width;

      // Fallback for totally empty before any string inserted.
      $json_column_grids = empty($columns['grids']) ? Json::encode($this->grids) : $columns['grids'];
      $column_grids = is_string($json_column_grids) ? Json::decode($json_column_grids) : $json_column_grids;
      $nested_check = array_filter($this->nestedGrids);
      $nested_grids_end = empty($nested_check) ? '' : Json::encode($this->nestedGrids);
      $json_nested_grids = empty($columns['nested']) ? $nested_grids_end : $columns['nested'];

      // Fallback for not so empty when json grids deleted leaving to string.
      if (empty($column_grids)) {
        $json_column_grids = Json::encode($this->grids);
        $column_grids = $this->grids;
      }

      // Preview.
      $preview = $common = [];
      $disabled = FALSE;
      $preview_description = '';
      $config_js = $this
        ->gridStack()
        ->getOptions('settings') ?: $this->default
        ->getOptions('settings');
      $config_css = $this
        ->getNestedSettings();

      // Auto is not bad at preview, provide the exact cellHeight instead.
      if (isset($config_js['cellHeight']) && $config_js['cellHeight'] == -1) {
        $config_js['cellHeight'] = 60;
      }

      // Beware to keep defaults, the library appears to hard-code it regardless
      // the options at some places like nested. Meaning customs are ignored.
      $common['breakpoint'] = $column;
      $common['itemClass'] = 'box';
      $common['handle'] = '.box__content';
      $common['column'] = $active_column;
      if ($column == $this->iconBreakpoint) {
        $preview_description = $this
          ->getDescription('lg');
      }
      if ($column == 'xs' && !$this->useNested) {
        $disabled = TRUE;
        $preview_description = $this
          ->getDescription('sm');
      }
      if ($preview_description && !$this->isVariant) {
        $preview['#prefix'] = '<h3 class="form__title form__title--preview">' . $preview_description . '</h3>';
      }
      if ($disabled || $column == $this->smallestBreakpoint) {
        $config_js['resizable'] = $config_css['resizable'] = (object) [
          'handles' => 's',
        ];
        if ($this->useNested) {
          $config_css['resizable'] = (object) [
            'handles' => 'e, se, s, sw, w',
          ];
        }
        else {
          $config_js['column'] = 1;
        }
      }
      else {
        $config_js['resizable'] = $config_css['resizable'] = (object) [
          'handles' => 'e, se, s, sw, w',
        ];
      }
      $preview['#theme'] = 'gridstack_ui_admin';
      $preview['#items'] = [];
      $preview['#settings'] = $this->jsSettings;
      $preview['#weight'] = -10;
      $preview['#content_attributes'] = [
        'class' => [
          'gridstack--root',
          'gridstack--' . $column,
          'is-gs-enabled',
          $column == $this->iconBreakpoint ? 'gridstack--main' : 'gridstack--sub',
        ],
        'data-breakpoint' => $column,
        'data-config' => Json::encode(array_merge($common, $config_js)),
        'data-config-nested' => Json::encode(array_merge($common, $config_css)),
        'data-is-nested' => $this->useNested ? 1 : 0,
        'data-preview-grids' => $this
          ->getNodes($json_column_grids),
        'data-nested-grids' => $this
          ->getNodesNested($json_column_grids, $json_nested_grids),
        'data-storage' => $storage,
        'data-nested-storage' => $nested_storage,
        'data-gs-column' => $disabled ? 1 : $active_column,
        'data-gs-node-config' => Json::encode($nodes),
        'data-responsive-width' => $active_width,
      ];
      if ($column == $this->smallestBreakpoint) {
        $preview['#content_attributes']['class'][] = 'gridstack--smallest';
      }
      if ($this->isVariant) {
        $preview['#content_attributes']['class'][] = 'gridstack--variant';
      }

      // Build preview.
      $form[$column]['preview'] = $preview;

      // Breakpoint elements.
      foreach ($elements as $key => $element) {
        if ($key == 'breakpoint') {
          continue;
        }

        // Elements.
        $form[$column][$key] = $element;
        $form[$column][$key]['#title_display'] = 'before';
        $form[$column][$key]['#wrapper_attributes']['class'][] = 'form-item--' . str_replace('_', '-', $key);
        $form[$column]['breakpoint']['#wrapper_attributes']['class'][] = 'visually-hidden';

        // Overrides base.
        $form[$column]['width']['#weight'] = 10;
        $form[$column]['width']['#title'] = $this
          ->t('@breakpoint width', [
          '@breakpoint' => $column,
        ]);
        $form[$column]['width']['#field_suffix'] = 'px';
        $form[$column]['width']['#attributes']['data-target'] = '#gridstack-' . $column;
        $form[$column]['width']['#description'] = $this
          ->getDescription('width');
        $form[$column][$key]['#default_value'] = isset($columns[$key]) ? $columns[$key] : '';
        $form[$column]['column'] = [
          '#type' => 'select',
          '#title' => $this
            ->t('Column'),
          '#options' => $this
            ->getColumnOptions(),
          '#empty_option' => $this
            ->t('- None -'),
          '#default_value' => $active_column,
          '#weight' => 11,
          '#attributes' => [
            'class' => [
              'form-select--column',
            ],
            'data-target' => '#gridstack-' . $column,
          ],
          '#description' => $this
            ->getDescription('column'),
          '#wrapper_attributes' => [
            'class' => [
              'form-item--column',
            ],
          ],
          '#access' => !$this->useNested,
          '#disabled' => $this->isVariant,
        ];
        if ($column == 'xs' && !$this->useNested) {
          $form[$column]['column']['#type'] = 'hidden';
          $form[$column]['column']['#default_value'] = 1;
        }
        if ($column == $this->iconBreakpoint) {
          $form[$column]['column']['#description'] .= ' ' . $this
            ->getDescription('column_icon');
        }

        // The actual grid elements which store the settings.
        $form[$column]['grids'] = [
          '#type' => 'hidden',
          '#default_value' => $this
            ->getNodes($json_column_grids),
          '#weight' => 20,
          '#wrapper_attributes' => [
            'class' => [
              'visually-hidden',
            ],
          ],
        ];
        $form[$column]['nested'] = [
          '#type' => 'hidden',
          '#default_value' => empty($columns['nested']) ? '' : $this
            ->getNodesNested($json_column_grids, $columns['nested']),
          '#weight' => 20,
          '#wrapper_attributes' => [
            'class' => [
              'visually-hidden',
            ],
          ],
        ];

        // Hard-code the default to avoid changes.
        if ($this->isDefault) {
          $form[$column][$key]['#wrapper_attributes'] = [
            'class' => [
              'visually-hidden',
            ],
          ];
          $form[$column][$key]['#description'] = '';
          $form[$column]['column']['#type'] = 'hidden';
          $form[$column]['column']['#default_value'] = 12;
          $form[$column]['width']['#default_value'] = 1200;
        }
        if ($this->isVariant) {
          $form[$column]['column']['#wrapper_attributes'] = [
            'class' => [
              'visually-hidden',
            ],
          ];
          $form[$column]['width']['#wrapper_attributes'] = [
            'class' => [
              'visually-hidden',
            ],
          ];
        }
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
EntityForm::$entity protected property The entity being used by this form. 7
EntityForm::$entityTypeManager protected property The entity type manager. 3
EntityForm::$moduleHandler protected property The module handler service.
EntityForm::$operation protected property The name of the current operation.
EntityForm::$privateEntityManager private property The entity manager.
EntityForm::actions protected function Returns an array of supported actions for the current entity form. 29
EntityForm::actionsElement protected function Returns the action form element for the current entity form.
EntityForm::afterBuild public function Form element #after_build callback: Updates the entity with submitted data.
EntityForm::buildEntity public function Builds an updated entity object based upon the submitted form values. Overrides EntityFormInterface::buildEntity 2
EntityForm::buildForm public function Form constructor. Overrides FormInterface::buildForm 10
EntityForm::copyFormValuesToEntity protected function Copies top-level form values to entity properties 7
EntityForm::getBaseFormId public function Returns a string identifying the base form. Overrides BaseFormIdInterface::getBaseFormId 5
EntityForm::getEntity public function Gets the form entity. Overrides EntityFormInterface::getEntity
EntityForm::getEntityFromRouteMatch public function Determines which entity will be used by this form from a RouteMatch object. Overrides EntityFormInterface::getEntityFromRouteMatch 1
EntityForm::getFormId public function Returns a unique string identifying the form. Overrides FormInterface::getFormId 10
EntityForm::getOperation public function Gets the operation identifying the form. Overrides EntityFormInterface::getOperation
EntityForm::init protected function Initialize the form state and the entity before the first form build. 3
EntityForm::prepareEntity protected function Prepares the entity object before the form is built first. 3
EntityForm::prepareInvokeAll protected function Invokes the specified prepare hook variant.
EntityForm::processForm public function Process callback: assigns weights and hides extra fields.
EntityForm::setEntity public function Sets the form entity. Overrides EntityFormInterface::setEntity
EntityForm::setEntityManager public function Sets the entity manager for this form. Overrides EntityFormInterface::setEntityManager
EntityForm::setEntityTypeManager public function Sets the entity type manager for this form. Overrides EntityFormInterface::setEntityTypeManager
EntityForm::setModuleHandler public function Sets the module handler for this form. Overrides EntityFormInterface::setModuleHandler
EntityForm::setOperation public function Sets the operation for this form. Overrides EntityFormInterface::setOperation
EntityForm::submitForm public function This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state… Overrides FormInterface::submitForm 17
EntityForm::__get public function
EntityForm::__set public function
FormBase::$configFactory protected property The config factory. 1
FormBase::$requestStack protected property The request stack. 1
FormBase::$routeMatch protected property The route match.
FormBase::config protected function Retrieves a configuration object.
FormBase::configFactory protected function Gets the config factory for this form. 1
FormBase::container private function Returns the service container.
FormBase::currentUser protected function Gets the current user.
FormBase::getRequest protected function Gets the request object.
FormBase::getRouteMatch protected function Gets the route match.
FormBase::logger protected function Gets the logger for a specific channel.
FormBase::redirect protected function Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait::redirect
FormBase::resetConfigFactory public function Resets the configuration factory.
FormBase::setConfigFactory public function Sets the config factory for this form.
FormBase::setRequestStack public function Sets the request stack object to use.
GridStackForm::form public function Gets the actual form array to be built. Overrides GridStackFormBase::form 1
GridStackForm::getDescription protected function Returns form item description.
GridStackForm::optionsForm protected function Sets up the options form.
GridStackForm::previewForm protected function Sets up the preview form.
GridStackForm::settingsForm protected function Sets up the settings form.
GridStackFormBase::$adminCss protected property The flag whether the admin CSS is enabled, or not.
GridStackFormBase::$blazyAdmin protected property The blazy manager service.
GridStackFormBase::$breakpointCount protected property The total breakpoint count.
GridStackFormBase::$cssConfig protected property The jsonified config for css-driven layouts.
GridStackFormBase::$default protected property The GridStack default entity.
GridStackFormBase::$engine protected property The layout engine.
GridStackFormBase::$fileSystem protected property The file system service.
GridStackFormBase::$framework protected property The active CSS framework.
GridStackFormBase::$grids protected property The main grids.
GridStackFormBase::$gridStack protected property The gridstack instance to distinguish from the current entity.
GridStackFormBase::$html5Ac protected property The flag whether to use HTML5 autocomplete suggestions, or not.
GridStackFormBase::$iconBreakpoint protected property Which breakpoint to generate icon from.
GridStackFormBase::$isDefault protected property The flag whether the entity is default, or not.
GridStackFormBase::$isVariant protected property Defines the variant. 1
GridStackFormBase::$jsConfig protected property The jsonified config for js-driven layouts.
GridStackFormBase::$jsSettings protected property The required settings by admin preview.
GridStackFormBase::$machineName protected property Defines the machine name. 1
GridStackFormBase::$manager protected property The GridStack manager service.
GridStackFormBase::$nestedGrids protected property The main grids.
GridStackFormBase::$nestedSettings protected property The CSS framework settings.
GridStackFormBase::$niceName protected property Defines the nice name. 1
GridStackFormBase::$options protected property The options.
GridStackFormBase::$regionSuggestions protected property The region suggestions.
GridStackFormBase::$settings protected property The active settings.
GridStackFormBase::$smallestBreakpoint protected property The smallest breakpoint can be SM for Foundation, XS for the rest.
GridStackFormBase::$useNested protected property The flag whether the nested option (framework) is enabled, or not.
GridStackFormBase::breakpointElements protected function Defines breakpoints form adopted from Blazy deprecated methods.
GridStackFormBase::create public static function Instantiates a new instance of this class. Overrides FormBase::create
GridStackFormBase::getApplicableBreakpoints protected function Returns the applicable breakpoints. 1
GridStackFormBase::getColumnOptions protected function Returns the supported columns.
GridStackFormBase::getNestedSettings protected function Returns the CSS settings.
GridStackFormBase::getNodes protected function Returns JSON for options.breakpoints[xs|sm|md|lg|xl] keyed by nodes.
GridStackFormBase::getNodesNested protected function Returns JSON for options.breakpoints[xs|sm|md|lg|xl] keyed by nodes.
GridStackFormBase::getRegionSuggestions protected function Returns the region suggestions.
GridStackFormBase::getUserInputValues protected static function Returns user input values.
GridStackFormBase::gridStack protected function Returns the gridstack instance.
GridStackFormBase::initEngine protected function Initializes the layout engine.
GridStackFormBase::jsonForm protected function Returns the json form.
GridStackFormBase::jsonify protected function Convert the config into a JSON object to reduce logic at frontend.
GridStackFormBase::massageSettings protected function Massages the settings specific for when CSS Framework is disabled.
GridStackFormBase::regionForm protected function Returns the region form.
GridStackFormBase::save public function Overrides Drupal\Core\Entity\EntityFormController::save(). Overrides EntityForm::save 1
GridStackFormBase::saveImage protected function Saves the icon based on the current grid display.
GridStackFormBase::setGridStack protected function Sets the gridstack instance.
GridStackFormBase::useFramework protected function Returns TRUE if should use framework.
GridStackFormBase::validateBreakpointForm protected function Validate breakpoint form.
GridStackFormBase::validateForm public function Form validation handler. Overrides FormBase::validateForm
LinkGeneratorTrait::$linkGenerator protected property The link generator. 1
LinkGeneratorTrait::getLinkGenerator Deprecated protected function Returns the link generator.
LinkGeneratorTrait::l Deprecated protected function Renders a link to a route given a route name and its parameters.
LinkGeneratorTrait::setLinkGenerator Deprecated public function Sets the link generator service.
LoggerChannelTrait::$loggerFactory protected property The logger channel factory service.
LoggerChannelTrait::getLogger protected function Gets the logger for a specific channel.
LoggerChannelTrait::setLoggerFactory public function Injects the logger channel factory.
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
RedirectDestinationTrait::$redirectDestination protected property The redirect destination service. 1
RedirectDestinationTrait::getDestinationArray protected function Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url.
RedirectDestinationTrait::getRedirectDestination protected function Returns the redirect destination service.
RedirectDestinationTrait::setRedirectDestination public function Sets the redirect destination service.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
UrlGeneratorTrait::$urlGenerator protected property The url generator.
UrlGeneratorTrait::getUrlGenerator Deprecated protected function Returns the URL generator service.
UrlGeneratorTrait::setUrlGenerator Deprecated public function Sets the URL generator service.
UrlGeneratorTrait::url Deprecated protected function Generates a URL or path for a specific route based on the given parameters.