You are here

public function GridStackAdmin::openingForm in GridStack 8

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

Returns the opening form elements.

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

File

src/Form/GridStackAdmin.php, line 103

Class

GridStackAdmin
Provides resusable admin functions or form elements.

Namespace

Drupal\gridstack\Form

Code

public function openingForm(array &$form, $definition = []) {
  $path = drupal_get_path('module', 'gridstack');
  $readme = Url::fromUri('base:' . $path . '/README.txt')
    ->toString();
  if (!isset($form['optionset'])) {
    $this->blazyAdmin
      ->openingForm($form, $definition);
    if ($this
      ->manager()
      ->getModuleHandler()
      ->moduleExists('gridstack_ui')) {
      $route_name = 'entity.gridstack.collection';
      $form['optionset']['#description'] = $this
        ->t('Manage optionsets at <a href=":url" target="_blank">the optionset admin page</a>.', [
        ':url' => Url::fromRoute($route_name)
          ->toString(),
      ]);
    }
  }
  if (isset($form['skin'])) {
    $form['skin']['#description'] = $this
      ->t('Skins allow various layouts with just CSS. Some options below depend on a skin. Leave empty to DIY. Or use hook_gridstack_skins_info() and implement \\Drupal\\gridstack\\GridStackSkinInterface to register ones.', [
      ':url' => $readme,
    ]);
  }
  if (isset($form['background'])) {
    $form['background']['#description'] = $this
      ->t('If trouble with image sizes not filling the given box, check this to turn the image into CSS background instead. To assign different image style per grid/box, edit the working optionset.');
  }
}