You are here

public function GridStackAdmin::mainForm in GridStack 8.2

Same name and namespace in other branches
  1. 8 src/Form/GridStackAdmin.php \Drupal\gridstack\Form\GridStackAdmin::mainForm()

Returns the main form elements.

1 call to GridStackAdmin::mainForm()
GridStackAdmin::buildSettingsForm in src/Form/GridStackAdmin.php
Returns all settings form elements.

File

src/Form/GridStackAdmin.php, line 135

Class

GridStackAdmin
Provides reusable admin functions or form elements.

Namespace

Drupal\gridstack\Form

Code

public function mainForm(array &$form, $definition = []) {
  if (!empty($definition['image_style_form'])) {
    $this->blazyAdmin
      ->imageStyleForm($form, $definition);
  }
  if (!empty($definition['media_switch_form'])) {
    $this->blazyAdmin
      ->mediaSwitchForm($form, $definition);
  }
  if (!empty($definition['fieldable_form'])) {
    $this->blazyAdmin
      ->fieldableForm($form, $definition);
    if (!empty($definition['links'])) {
      $form['category'] = [
        '#title' => $this
          ->t('Category'),
        '#type' => 'select',
        '#options' => $definition['links'],
        '#description' => $this
          ->t('The category to display inside the box.'),
      ];
    }
  }
  if (!empty($definition['stamps'])) {
    $form['stamp'] = [
      '#title' => $this
        ->t('Stamp'),
      '#type' => 'select',
      '#options' => $definition['stamps'],
      '#description' => $this
        ->t('Stamp is _just a unique list, <b>Html list</b>, such as Latest news, blogs, testimonials, etc. replacing one of the other boring boxes, including rich ones. Leave empty to not use stamp.'),
      '#weight' => -67,
    ];
    $form['stamp_index'] = [
      '#title' => $this
        ->t('Stamp index'),
      '#type' => 'textfield',
      '#description' => $this
        ->t('Which index, a stamp should be inserted into.'),
      '#weight' => -66,
    ];
  }

  // Re-purpose/use the existing option Overlay for the Rich box.
  if (isset($form['overlay'])) {
    $form['overlay']['#title'] = $this
      ->t('Rich box');
    $form['overlay']['#description'] = $this
      ->t('Replace <b>Main stage/ image</b> if a node has one. It can be any entity reference, like Block, etc. Use block_field.module for ease of block additions. How? Create a sticky (or far future created) node or two containing a Slick carousel, video, weather, time, donations, currency, ads, or anything as a block field, and put it here. Be sure different from the <b>Main stage</b>. While regular boxes are updated with new contents, these rich boxes may stay the same, and sticky (Use Views with sort by sticky or desc by creation).');
    $form['overlay']['#weight'] = -65;
  }
  if (!empty($definition['breakpoints'])) {
    $this->blazyAdmin
      ->breakpointsForm($form, $definition);
  }
}