feat(options): Groups tab with intro and two columns; group colors become color choosers; font options Normal|Bold|Italic|Bold italic

Row 157. Groups pane gets a full-width h2 'Groups' + explanatory text and a
two-column slot layout: col 1 = group title options (font, color, custom,
size, font options), col 2 = same for the group description (singular wording).
grouptitletextcolor/groupdescriptiontextcolor switch from the old 4-way
dropdown to the row-135 color chooser (6 modes, default 'Default font color',
swatch chips, grayed-out custom picker unless 'other'); legacy stored modes
primary/secondary and raw hex migrate client-side (options.js) and in the views.
The old *fontweight keys (400|700) become *fontoptions (normal|bold|italic|
bolditalic), mapped to font-weight/font-style in custom_header.twig with a
legacy 400/700 fallback until theme reset. build.php migrates variant jsons
(chooser hex/modes + fontweight keys). OPTIONS_JS_TOKEN 20261127.1.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-27 02:50:06 +01:00
commit 956324775b

View file

@ -268,19 +268,40 @@ foreach ($logoPositions as $pos) {
}
}
// --- Row 115/135/149 migration: the color-chooser options (navbarfontcolor,
// --- Row 115/135/149/157 migration: the color-chooser options (navbarfontcolor,
// headerbackgroundcolor, progressbarcolor, progressbarbackgroundcolor,
// progressbarfontcolor, bodybackgroundcolor) became mode dropdowns (default|defaultbackgroundcolor|
// progressbarfontcolor, bodybackgroundcolor, grouptitletextcolor,
// groupdescriptiontextcolor) became mode dropdowns (default|defaultbackgroundcolor|
// color1|color2|color3|other) with a <key>custom colorpicker child. A legacy HEX
// value in the json means "custom color": map it to mode "other" and move the hex
// into the <key>custom child, so the variant default stays valid for the dropdown.
$colorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor'];
// A legacy mode "primary"/"secondary" (old 4-way group textcolor dropdown) maps to
// "color1"/"color2".
$colorChooserKeys = ['navbarfontcolor', 'headerbackgroundcolor', 'progressbarcolor', 'progressbarbackgroundcolor', 'progressbarfontcolor', 'bodybackgroundcolor', 'grouptitletextcolor', 'groupdescriptiontextcolor'];
$colorChooserLegacyModes = ['primary' => 'color1', 'secondary' => 'color2'];
foreach ($colorChooserKeys as $ck) {
if (isset($definition['options'][$ck])
&& is_string($definition['options'][$ck])
&& preg_match('/^#[0-9a-fA-F]{3,8}$/', $definition['options'][$ck])) {
$definition['options'][$ck . 'custom'] = $definition['options'][$ck];
$definition['options'][$ck] = 'other';
} elseif (isset($definition['options'][$ck])
&& is_string($definition['options'][$ck])
&& isset($colorChooserLegacyModes[$definition['options'][$ck]])) {
$definition['options'][$ck] = $colorChooserLegacyModes[$definition['options'][$ck]];
}
}
// --- Row 157 migration: the old <el>fontweight json keys (400|700) became
// <el>fontoptions (normal|bold|italic|bolditalic); map the old values and remove
// the old keys so the unknown-key check below does not fail on them.
$fontWeightToOptions = ['400' => 'normal', '700' => 'bold'];
foreach (['grouptitle', 'groupdescription'] as $el) {
$oldKey = $el . 'fontweight';
if (isset($definition['options'][$oldKey])) {
$w = (string) $definition['options'][$oldKey];
$definition['options'][$el . 'fontoptions'] = $fontWeightToOptions[$w] ?? 'normal';
unset($definition['options'][$oldKey]);
}
}