feat(options): logo section as 3 columns (file/margin/per-device) in Top-of-page tab

Prompt M: per logo position (left=brand, center, right) the options page now
shows one column with vertical separators and an <hr> below: file dropdown
with 'No logo' (off) first, top margin as plain number 0-100, and 'Show logo
on' with computer/tablet/mobile checkboxes. New option keys per position:
<pos>logofile, <pos>logotopmargin, <pos>showon{computer,tablet,mobile};
old keys (brandlogo/centerlogo/rightlogo, *logohideonsmall, shared
logotopmargin) removed from config.xml. Views map the checkboxes to
Bootstrap display classes per breakpoint and emit per-logo padding-top;
variants/build.php migrates the old json keys to the new ones.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-24 23:14:10 +01:00
commit 751954c340

View file

@ -228,6 +228,46 @@ if (!empty($definition['fontOptions'])
&& (empty($definition['options']) || !isset($definition['options']['font']))) {
$definition['options']['font'] = preg_replace('/[^a-z0-9_]/i', '_', (string) $definition['fontOptions'][0]['value']);
}
// --- Prompt M migration: map the OLD logo json keys to the NEW per-logo keys ---
// Old model: <pos>logo ("on"/"off") + <pos>logofile (path) + <pos>logohideonsmall
// ("on" = hide below the md breakpoint) + one shared logotopmargin ("15px").
// New model: <pos>logofile ("off" = no logo, path = show), <pos>logotopmargin (plain
// number 0-100), <pos>showon{computer,tablet,mobile} ("on"/"off").
// The old keys are removed from the json options afterwards, so the unknown-key
// check below does not fail on them.
$logoPositions = ['brand', 'center', 'right'];
if (!isset($definition['options']) || !is_array($definition['options'])) {
$definition['options'] = [];
}
if (isset($definition['options']['logotopmargin'])) {
$margin = preg_replace('/[^0-9]/', '', (string) $definition['options']['logotopmargin']);
if ($margin === '') {
$margin = '15';
}
foreach ($logoPositions as $p) {
$definition['options'][$p . 'logotopmargin'] = $margin;
}
unset($definition['options']['logotopmargin']);
}
foreach ($logoPositions as $pos) {
$oldOn = $pos . 'logo';
$oldHide = $pos . 'logohideonsmall';
if (isset($definition['options'][$oldOn]) && $definition['options'][$oldOn] === 'off') {
// old "off" wins over any file: in the new model the logo is hidden via logofile = "off"
$definition['options'][$pos . 'logofile'] = 'off';
}
unset($definition['options'][$oldOn]);
if (isset($definition['options'][$oldHide])) {
// old hideonsmall "on" = hide on mobile only -> showonmobile "off";
// old "off" = never hide -> show on all devices
$showEverywhere = ($definition['options'][$oldHide] !== 'on');
$definition['options'][$pos . 'showoncomputer'] = 'on';
$definition['options'][$pos . 'showontablet'] = 'on';
$definition['options'][$pos . 'showonmobile'] = $showEverywhere ? 'on' : 'off';
unset($definition['options'][$oldHide]);
}
}
$optionsNode = $xpath->query('//options')->item(0);
if ($optionsNode === null) {
fwrite(STDERR, "No <options> section found in mother config\n");