feat(variants): no Respondage theme footer in variants, keep options-page footer
Variants inherit views from the mother via <extends>; the mother's views/subviews/footer/footer.twig shows a Respondage credit to respondents, which variants must NOT show. build.php now writes an empty views/subviews/footer/footer.twig override into every generated variant (a client-supplied footer.twig in the definitions dir still wins), so LimeSurvey's view resolver picks the variant's own empty file. The Respondage footer on the admin options page (options/options.twig) is separate and is NOT overridden. Verified via SurveyThemeHelper::getRealThemeFilePath: mother resolves to its own footer.twig (with credit), respondage_defensie and respondage_erasmus resolve to their own empty override. Both variants rebuilt with the private definitions dir. Options page still renders the respondage-footer in every tab (7x). export leak-check green. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
0a725f516c
commit
60f86ff812
1 changed files with 22 additions and 0 deletions
|
|
@ -11,6 +11,11 @@
|
||||||
* config.xml in which ONLY the house-style option values (colors, fonts,
|
* config.xml in which ONLY the house-style option values (colors, fonts,
|
||||||
* font sizes/colors/weights, logo files) listed in variants/<name>.json
|
* font sizes/colors/weights, logo files) listed in variants/<name>.json
|
||||||
* are replaced, plus the metadata (name/title/description/extends).
|
* are replaced, plus the metadata (name/title/description/extends).
|
||||||
|
* Additionally an EMPTY views/subviews/footer/footer.twig override is
|
||||||
|
* written (unless the variant ships its own): the mother's footer shows a
|
||||||
|
* Respondage credit to respondents, variants must NOT show it. The
|
||||||
|
* Respondage footer on the admin options page (options/options.twig) is
|
||||||
|
* separate and is NOT overridden.
|
||||||
* The <engine> section is emptied except <optionspage>, so engine settings
|
* The <engine> section is emptied except <optionspage>, so engine settings
|
||||||
* (css framework, packages, view/files directories, template editor) are
|
* (css framework, packages, view/files directories, template editor) are
|
||||||
* inherited from the mother. The <files> section is kept as-is: LimeSurvey
|
* inherited from the mother. The <files> section is kept as-is: LimeSurvey
|
||||||
|
|
@ -268,6 +273,23 @@ if (is_dir($variantAssets)) {
|
||||||
echo "Copied variant assets: $variantAssets -> $variantDir\n";
|
echo "Copied variant assets: $variantAssets -> $variantDir\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- footer override: variants show NO Respondage theme footer to respondents ---
|
||||||
|
// The mother's views/subviews/footer/footer.twig renders a "proudly developed by
|
||||||
|
// Respondage" credit; in a variant that must not appear (the Respondage footer on
|
||||||
|
// the admin OPTIONS page lives in options/options.twig and is NOT overridden).
|
||||||
|
// LimeSurvey resolves a view in the variant folder first, so an (empty) override
|
||||||
|
// file here wins over the inherited mother view. A client-supplied
|
||||||
|
// <variantName>/views/subviews/footer/footer.twig (copied above) takes precedence.
|
||||||
|
$variantFooterDir = $variantDir . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'subviews' . DIRECTORY_SEPARATOR . 'footer';
|
||||||
|
$variantFooterFile = $variantFooterDir . DIRECTORY_SEPARATOR . 'footer.twig';
|
||||||
|
if (!is_file($variantFooterFile)) {
|
||||||
|
if (!is_dir($variantFooterDir)) {
|
||||||
|
mkdir($variantFooterDir, 0775, true);
|
||||||
|
}
|
||||||
|
file_put_contents($variantFooterFile, "{#\n Variant override (generated by build.php): render NOTHING.\n The mother theme vanilla_respondage shows a Respondage credit in its\n views/subviews/footer/footer.twig; variants must not show it to respondents.\n The Respondage footer on the admin options page (options/options.twig) is\n separate and stays.\n#}\n");
|
||||||
|
echo "Wrote empty footer override: $variantFooterFile\n";
|
||||||
|
}
|
||||||
|
|
||||||
echo "Variant '$variantName' built: $out\n";
|
echo "Variant '$variantName' built: $out\n";
|
||||||
echo 'Options overridden: ' . (empty($definition['options']) ? '(none)' : implode(', ', array_keys($definition['options']))) . "\n";
|
echo 'Options overridden: ' . (empty($definition['options']) ? '(none)' : implode(', ', array_keys($definition['options']))) . "\n";
|
||||||
echo "Note: existing files in $variantDir were OVERWRITTEN from the definitions dir.\n";
|
echo "Note: existing files in $variantDir were OVERWRITTEN from the definitions dir.\n";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue