refactor(options): config.xml categories now equal the options.twig tab labels

Row 159. When the options page falls back to the core renderer
(optionspage=core), options are grouped by their config.xml category — so
each category must be the tab it lives in under the custom options.twig:
group keys -> 'Groups', top-of-page keys (logos, header/navbar/progress
colors, progress position, sticky, height) -> 'Top of the page',
background keys -> 'Page background', font/color keys -> 'Default fonts and
colors', the former 'Simple options' -> 'Other options'. Tab ids are kept,
so stored tab preferences stay valid. 'Colors' remains for
sliderhandlecolor/privacybackgroundcolor (no custom tab yet, Prompt T).

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-27 03:07:30 +01:00
commit cbcf3c75bd

View file

@ -12,17 +12,18 @@
(fontselect = per-element font override: same choices as the base "font"
dropdown plus "Same as base font"; see the branch below.)
Tab order: the "Fonts" category tab is FIRST (default font + per-element font
overrides), then the "Top of the page" tab, then the "Page background" tab (the
config.xml "Images" category), then the "Groups" tab (all group-related options
of the "Questions" category), then the other remaining categories, and LAST the
"Other options" tab (the config.xml "Simple options" category).
Tab order: the "Default fonts and colors" category tab is FIRST (default font +
per-element font overrides), then the "Top of the page" tab, then the "Page
background" tab, then the "Groups" tab, then the other remaining categories,
and LAST the "Other options" tab.
Exception: the options that make up the TOP OF THE PAGE (header menu, logos,
header colors, progress bar) are pulled out of their config.xml categories
into a dedicated tab, "Top of the page" (see aTopOfPageKeys below).
Values are stored per option key, so this regrouping does not touch stored
values and needs no theme reset to take effect.
Row 159: the config.xml category names ARE these tab labels, so switching back
to the core options renderer (optionspage=core, which groups by category) shows
the same grouping. The tab ids of the first/last tabs ('category-fonts',
'category-images', 'category-simple-options') are kept as they were, so stored
tab preferences stay valid. Values are stored per option key, so this
regrouping does not touch stored values and needs no theme reset to take
effect.
options/options.js is a copy of the core assets/packages/themeoptions-core/
themeoptions-core.js (patched to also hide .action_hide_on_inherit rows when
@ -295,22 +296,24 @@
{% set aGroupCol1 = ['grouptitlefont', 'grouptitletextcolor', 'grouptitletextcolorcustom', 'grouptitlefontsize', 'grouptitlefontoptions'] %}
{% set aGroupCol2 = ['groupdescriptionfont', 'groupdescriptiontextcolor', 'groupdescriptiontextcolorcustom', 'groupdescriptionfontsize', 'groupdescriptionfontoptions'] %}
{# Tab list: FIRST the "Fonts" tab (where the default/base font is chosen and the
per-element font overrides live), then the "Top of the page" tab (keys =
aTopOfPageKeys), then row 147: the "Page background" tab (the config.xml "Images"
category, id kept as 'category-images' so the stored tab preference stays valid),
then the "Groups" tab (keys = aGroupKeys), then one tab per remaining category
from config.xml like the core options page (keys = null: all options of that
category, except the top-of-page and group keys). #}
{# Tab list: FIRST the "Default fonts and colors" tab (where the default/base font
is chosen and the per-element font overrides live), then the "Top of the page"
tab (keys = aTopOfPageKeys), then row 147: the "Page background" tab (the
config.xml "Page background" category, id kept as 'category-images' so the
stored tab preference stays valid), then the "Groups" tab (keys = aGroupKeys),
then one tab per remaining category from config.xml like the core options page
(keys = null: all options of that category). Row 159: config.xml category names
equal these tab labels. #}
{% set aTabs = [] %}
{% if 'Fonts' in aOptionAttributes.categories %}
{% set aTabs = [{ 'id': 'category-fonts', 'label': 'Default fonts and colors', 'category': 'Fonts', 'keys': null }] %}
{% if 'Default fonts and colors' in aOptionAttributes.categories %}
{% set aTabs = [{ 'id': 'category-fonts', 'label': 'Default fonts and colors', 'category': 'Default fonts and colors', 'keys': null }] %}
{% endif %}
{% set aTabs = aTabs|merge([{ 'id': 'top-of-page', 'label': 'Top of the page', 'category': 'Top of the page', 'keys': aTopOfPageKeys }]) %}
{# row 147: "Images" category -> "Page background" tab, directly after Top of the page #}
{# row 147/159: "Page background" category -> the Page background tab, directly after
Top of the page #}
{% set aImagesKeys = [] %}
{% for key, attr in aOptionAttributes.optionAttributes %}
{% if key != 'ajaxmode' and attr.category == 'Images' and key not in aTopOfPageKeys %}
{% if key != 'ajaxmode' and attr.category == 'Page background' and key not in aTopOfPageKeys %}
{% set aImagesKeys = aImagesKeys|merge([key]) %}
{% endif %}
{% endfor %}
@ -319,17 +322,17 @@
image on/off; col 2 = the three image-detail options; col 3 stays empty #}
{% set aImagesPaneKeys = ['bodybackgroundcolor', 'bodybackgroundcolorcustom', 'backgroundimage', 'backgroundimagefile', 'backgroundimagefixed', 'backgroundimagedisplay'] %}
{% if aImagesKeys is not empty %}
{% set aTabs = aTabs|merge([{ 'id': 'category-images', 'label': 'Page background', 'category': 'Images', 'keys': aImagesPaneKeys }]) %}
{% set aTabs = aTabs|merge([{ 'id': 'category-images', 'label': 'Page background', 'category': 'Page background', 'keys': aImagesPaneKeys }]) %}
{% endif %}
{# row 147/157: dedicated "Groups" tab with all group-related options (aGroupKeys).
category 'Groups' (no config.xml category of that name) so the pane renders the
{# row 147/157/159: dedicated "Groups" tab with all group-related options
(category "Groups" in config.xml, listed in aGroupKeys) so the pane renders the
slot layout below instead of the Questions 3-column grid. #}
{% set aTabs = aTabs|merge([{ 'id': 'groups', 'label': 'Groups', 'category': 'Groups', 'keys': aGroupKeys }]) %}
{% for category in aOptionAttributes.categories %}
{% if category != 'Fonts' and category != 'Top of the page' and category != 'Colors' and category != 'Images' and category != 'Simple options' %}
{% if category != 'Default fonts and colors' and category != 'Top of the page' and category != 'Colors' and category != 'Page background' and category != 'Groups' and category != 'Other options' %}
{# The "Colors" tab is removed on purpose. Its only remaining options are
sliderhandlecolor and privacybackgroundcolor (the other Colors keys are
pulled into "Top of the page" via aTopOfPageKeys) — TODO: place these two
sliderhandlecolor and privacybackgroundcolor (the other Colors keys carry
category "Top of the page" now) — TODO: place these two
options on another tab. #}
{# Resolve this category's keys once and skip the tab entirely when none
remain: e.g. "Progress" — its only option (progressbarposition)
@ -345,17 +348,17 @@
{% endif %}
{% endif %}
{% endfor %}
{# row 148: the "Simple options" category renders as "Other options", LAST in the
{# row 148/159: the "Other options" category renders LAST in the
tab row (id kept as 'category-simple-options' so the stored tab preference
stays valid) #}
{% set aSimpleKeys = [] %}
{% for key, attr in aOptionAttributes.optionAttributes %}
{% if key != 'ajaxmode' and attr.category == 'Simple options' and key not in aTopOfPageKeys and key not in aGroupKeys %}
{% if key != 'ajaxmode' and attr.category == 'Other options' and key not in aTopOfPageKeys and key not in aGroupKeys %}
{% set aSimpleKeys = aSimpleKeys|merge([key]) %}
{% endif %}
{% endfor %}
{% if aSimpleKeys is not empty %}
{% set aTabs = aTabs|merge([{ 'id': 'category-simple-options', 'label': 'Other options', 'category': 'Simple options', 'keys': null }]) %}
{% set aTabs = aTabs|merge([{ 'id': 'category-simple-options', 'label': 'Other options', 'category': 'Other options', 'keys': null }]) %}
{% endif %}
<ul class="nav nav-tabs mt-3" role="tablist">
@ -407,7 +410,7 @@
<p>{{ gT("Here you choose the default font, the font that is used on most places in your version of the theme.") }}</p>
</div></div>
{% endif %}
{% if tab.category == 'Images' %}
{% if tab.category == 'Page background' %}
{# row 149: full-width intro of the Page background tab; bgImgVal is the current
value of the backgroundimage on/off switch (drives the col-2 visibility) #}
{% set bgImgVal = bGeneralInherit ? 'inherit' : (aCurrentOptions['backgroundimage'] is defined ? aCurrentOptions['backgroundimage'] : (oParentOptions['backgroundimage'] is defined ? oParentOptions['backgroundimage'] : '')) %}
@ -434,9 +437,9 @@
Every slot is row+col (two divs), except 'logo' (self-contained block)
and 'rest' (normal grid). Computed BEFORE the logo-block branch so
the transition into the logo slot also fires. #}
{% set bFontsPane = tab.category == 'Fonts' %}
{% set bFontsPane = tab.category == 'Default fonts and colors' %}
{% set bTopPane = tab.id == 'top-of-page' %}
{% set bImagesPane = tab.category == 'Images' %}
{% set bImagesPane = tab.category == 'Page background' %}
{% set bGroupsPane = tab.id == 'groups' %}
{% set fSlot = 'rest' %}
{% if bFontsPane %}
@ -732,7 +735,7 @@
{% elseif attr.type == 'dropdown' %}
{% set ddClasses = 'form-select selector_option_value_field' %}
{% if attr.parent != '' %}{% set ddClasses = ddClasses ~ ' selector_radio_childfield' %}{% endif %}
{% if tab.category == 'Images' %}{% set ddClasses = ddClasses ~ ' selector_image_selector' %}{% endif %}
{% if tab.category == 'Page background' %}{% set ddClasses = ddClasses ~ ' selector_image_selector' %}{% endif %}
{% if key == 'font' %}{% set ddClasses = ddClasses ~ ' selector_fontselect' %}{% endif %}
{% if key in aColorChooserKeys %}{% set ddClasses = ddClasses ~ ' selector_color_mode' %}{% endif %}
<select class="{{ ddClasses }}"
@ -830,7 +833,7 @@
{% endif %}
{% endif %}
{% endfor %}
{% if tab.category == 'Images' %}
{% if tab.category == 'Page background' %}
{# row 149/150: close the open Page background column; after col 2 append
the empty col 3. Row 150: INSIDE col 2, under the image options, the
upload facility + help text — the column div carries option-visibility
@ -881,7 +884,7 @@
{% if tab.id == 'groups' and fLastSlot in ['g1', 'g2'] %}</div>{% endif %}
{# close an open slot container at the end of a Fonts/Top-of-page pane
(every non-logo, non-rest slot has exactly two open divs: row + col) #}
{% if (tab.category == 'Fonts' or tab.id == 'top-of-page') and fLastSlot != 0 and fLastSlot != 'rest' and fLastSlot != 'logo' %}</div></div>{% endif %}
{% if (tab.category == 'Default fonts and colors' or tab.id == 'top-of-page') and fLastSlot != 0 and fLastSlot != 'rest' and fLastSlot != 'logo' %}</div></div>{% endif %}
</div>
{# row 150: the upload facility is NOT full-width at the bottom any more — it