You are here

private function GridStackStylizer::mergeFrameworkAndInternalClasses in GridStack 8.2

Merges preset classes with the custom defined ones.

1 call to GridStackStylizer::mergeFrameworkAndInternalClasses()
GridStackStylizer::getMergedClasses in src/GridStackStylizer.php
Returns classes that can be used for select options.

File

src/GridStackStylizer.php, line 293

Class

GridStackStylizer
Implements GridStackStylizerInterface.

Namespace

Drupal\gridstack

Code

private function mergeFrameworkAndInternalClasses(array $classes = []) {
  $classes = $classes ? NestedArray::mergeDeep($this
    ->getInternalClasses(), $classes) : $this
    ->getInternalClasses();
  if ($fw_classes = $this
    ->config('fw_classes')) {
    $fw_classes = array_map('trim', explode("\n", $fw_classes));
    foreach ($fw_classes as $fw_class) {
      if (strpos($fw_class, '|') !== FALSE) {
        list($group, $group_class) = array_pad(array_map('trim', explode("|", $fw_class, 2)), 2, NULL);
        $group_classes = array_map('trim', explode(" ", $group_class));
        $new_group = [];
        foreach ($group_classes as $group_class) {
          $new_group[] = $group_class;
        }
        $new_group = isset($classes[$group]) ? NestedArray::mergeDeep($classes[$group], $new_group) : $new_group;
        $classes[$group] = array_unique($new_group);
      }
    }
  }
  return $classes;
}