You are here

public function GridStackStylizer::prepare in GridStack 8.2

Prepares the settings, selector and active styles.

File

src/GridStackStylizer.php, line 162

Class

GridStackStylizer
Implements GridStackStylizerInterface.

Namespace

Drupal\gridstack

Code

public function prepare(array &$element, array &$attributes, array &$settings, $optionset) {

  // Provides configurable attributes and background media if so configured.
  // Runs before ::containerAttributes to pass the media settings.
  $this
    ->setStyle($settings);
  if ($media = $this
    ->style()
    ->buildMedia($attributes, $settings)) {
    $element['#preface']['media'] = $media;
  }

  // Provides admin utilities.
  if (!empty($settings['_ipe'])) {
    $this
      ->setBuilder($settings);
    $this->regions = $this
      ->builder()
      ->regions($element);
    if ($links = $this
      ->builder()
      ->getVariantEditor($settings, $optionset)) {
      $pos = $this
        ->config('editor_pos') == 'bottom' ? '#bottom' : '#aside';
      $element[$pos]['layout_editor'] = $links;
    }
  }
}