public function GridStackStylizer::getMergedClasses in GridStack 8.2
Returns classes that can be used for select options.
Overrides GridStackStylizerInterface::getMergedClasses
File
- src/
GridStackStylizer.php, line 258
Class
- GridStackStylizer
- Implements GridStackStylizerInterface.
Namespace
Drupal\gridstackCode
public function getMergedClasses($flatten = FALSE, array $framework_classes = []) {
$cid = $flatten ? 'gridstack_classes_flattened' : 'gridstack_classes_grouped';
if ($cache = $this->cacheBackend
->get($cid)) {
return $cache->data;
}
$output = [];
if ($classes = $this
->mergeFrameworkAndInternalClasses($framework_classes)) {
$grouped = $ungrouped = [];
foreach ($classes as $group => $data) {
$grouped[$group] = $data;
$items = [];
foreach ($data as $datum) {
$items[] = $datum;
}
$ungrouped = NestedArray::mergeDeep($ungrouped, $items);
}
// Do not use array_unique() here, was processed per group instead.
$output = $flatten ? $ungrouped : $grouped;
$this->moduleHandler
->alter('gridstack_classes_preset', $output, $grouped, $ungrouped, $flatten);
ksort($output);
$count = count($output);
$tags = Cache::buildTags($cid, [
'count:' . $count,
]);
$this->cacheBackend
->set($cid, $output, Cache::PERMANENT, $tags);
}
return $output;
}