You are here

private function Form::getColorPalettes in GridStack 8.2

Provides color palettes.

1 call to Form::getColorPalettes()
Form::closingForm in src/Plugin/gridstack/stylizer/Form.php

File

src/Plugin/gridstack/stylizer/Form.php, line 458

Class

Form
Provides the form elements.

Namespace

Drupal\gridstack\Plugin\gridstack\stylizer

Code

private function getColorPalettes() {
  $colors = [];
  if ($palettes = $this
    ->config('palettes')) {
    $palettes = array_map('trim', explode("\n", $palettes));
    foreach ($palettes as $palette) {
      if (strpos($palette, '|') !== FALSE) {
        list($group, $group_color) = array_pad(array_map('trim', explode("|", $palette, 2)), 2, NULL);
        $group_colors = array_map('trim', explode(" ", $group_color));
        $colors[$group] = array_unique($group_colors);
      }
    }
  }
  return $colors;
}