protected function GridStackForm::settingsForm in GridStack 8.2
Sets up the settings form.
1 call to GridStackForm::settingsForm()
- GridStackForm::form in modules/
gridstack_ui/ src/ Form/ GridStackForm.php - Gets the actual form array to be built.
File
- modules/
gridstack_ui/ src/ Form/ GridStackForm.php, line 101
Class
- GridStackForm
- Extends base form for gridstack instance configuration form.
Namespace
Drupal\gridstack_ui\FormCode
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',
],
];
}