diff --git a/variants/build.php b/variants/build.php index aefda72..82d6a82 100644 --- a/variants/build.php +++ b/variants/build.php @@ -11,6 +11,11 @@ * config.xml in which ONLY the house-style option values (colors, fonts, * font sizes/colors/weights, logo files) listed in variants/.json * 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 section is emptied except , so engine settings * (css framework, packages, view/files directories, template editor) are * inherited from the mother. The section is kept as-is: LimeSurvey @@ -268,6 +273,23 @@ if (is_dir($variantAssets)) { 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 +// /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 '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";