allow to pre-define colors to choose from (#2481)

This commit is contained in:
Kevin Papst
2021-04-06 00:45:54 +02:00
committed by GitHub
parent f4dbdbb427
commit 68bb01d064
28 changed files with 574 additions and 21 deletions

View File

@@ -240,4 +240,40 @@ class SystemConfiguration implements SystemBundleConfiguration
{
return $this->getIncrement('timesheet.time_increment', $this->getTimesheetDefaultRoundingEnd(), 0);
}
// ========== Theme configurations ==========
public function isThemeColorsLimited(): bool
{
return (bool) $this->find('theme.colors_limited');
}
public function getThemeColorChoices(): ?array
{
$config = $this->find('theme.color_choices');
if (empty($config)) {
return null;
}
$config = explode(',', $config);
$colors = [];
foreach ($config as $item) {
if (empty($item)) {
continue;
}
$item = explode('|', $item);
$key = $item[0];
$value = $key;
if (\count($item) > 1) {
$value = $item[1];
}
if (empty($key)) {
$key = $value;
}
$colors[$key] = $value;
}
return array_unique($colors);
}
}