feat(variants): export a variant json from saved UI theme options

export_options.php reads lime_template_configuration.options for the mother
theme (global row, or --sid <surveyId> with fallback to global on 'inherit'),
fills in only the keys that differ from the mother config.xml defaults (rest
stay "" = inherit), normalizes image::theme::files/x.png to ./files/x.png,
includes the _formats map, and writes <definitions-dir>/<variantName>.json
(refuses overwrite without --force). DB credentials are read read-only from
application/config/config.php. Workflow documented in the README: pre-style a
customer variant in the LimeSurvey UI, export the json, fine-tune, build.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-30 17:04:48 +01:00
commit c996b27cd1

View file

@ -403,6 +403,21 @@ the variant's `preview.png` is identical to the mother's.
2. In the private variants repo, create `variants/<client>.json` with the
variant name/title/description and the option values, plus a `<client>/`
asset folder (logos, `files/fonts/`, `css/variant.css`,
**Fast start — pre-style in the UI, then export:** set the house-style
values once in the LimeSurvey UI (global Theme options of
`vanilla_respondage`, or the theme options of one survey), then generate
the json from those stored settings:
```
php variants/export_options.php <client> --global # or: --sid <surveyId>
php variants/export_options.php <client> --sid <surveyId> --title "Client LimeSurvey theme" --definitions-dir <dir> [--force]
```
`export_options.php` reads `lime_template_configuration.options` (read-only;
DB credentials come from `application/config/config.php`), fills in only the
keys whose stored value differs from the mother `config.xml` default (the
rest stay `""` = inherit), normalizes `image::theme::files/x.png` to
`./files/x.png`, and includes the `_formats` map. A survey row that stores
`inherit` falls back to the global row. `files_add`/`fontOptions` and the
`<client>/` asset folder still need manual setup afterwards.
`files/preview.svg`/`preview.png`). The json may list **ALL option keys**
of the mother `config.xml` (109 at the time of writing) so it is visible what
CAN be set per variant: an **empty value (`""`) means "inherit the default