fix: preserve other plugins' scripts in administration_login_scripts block#74
Open
nyxthelobster wants to merge 1 commit into
Open
fix: preserve other plugins' scripts in administration_login_scripts block#74nyxthelobster wants to merge 1 commit into
nyxthelobster wants to merge 1 commit into
Conversation
The administration index.html.twig template overrides the
`administration_login_scripts` block without calling `{{ parent() }}`.
This silently removes inline scripts that other plugins inject into the
same block.
A real-world example: Pickware's feature-flag-bundle injects
`window.PICKWARE_INITIAL_FEATURE_FLAGS_SERIALIZED` via this block. With
this plugin active, that script is dropped from the admin HTML, all
Pickware feature flags stay disabled, and the entire Pickware admin UI
(shipping buttons, warehouse modules, etc.) disappears - while all JS
bundles still load without errors, which makes this extremely hard to
debug.
Changes:
- Call `{{ parent() }}` at the start of the block so content from other
plugins is preserved
- Use `sw_extends` instead of `extends` so Shopware's template
inheritance chain (which allows multiple plugins to extend the same
template) is used
Co-authored-by: Fabian Budde <188329353+fabudde@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
src/Resources/views/administration/index.html.twigoverrides theadministration_login_scriptsblock without calling{{ parent() }}, and uses plain{% extends %}instead of Shopware's{% sw_extends %}.Since multiple plugins can extend the administration
index.html.twig, this silently drops inline scripts that other plugins inject into the same block.Real-world impact
We hit this in production (Shopware 6.7.11.1): Pickware's feature-flag-bundle injects
window.PICKWARE_INITIAL_FEATURE_FLAGS_SERIALIZEDviaadministration_login_scripts. With this 2FA plugin active, that script was removed from the admin HTML, so all Pickware feature flags stayed disabled and the entire Pickware admin UI disappeared (shipping buttons, warehouse modules, DHL, ...).This was extremely hard to debug because nothing visibly fails: all JS bundles still load with HTTP 200,
window.Pickwareexists, no console errors - the modules just never register because their feature flags are missing.Fix
{{ parent() }}at the beginning of the block so content contributed by other plugins is preserved{% sw_extends %}so Shopware's template inheritance chain (which supports multiple plugins extending the same template) is usedThe 2FA login override itself keeps working exactly as before - verified in production alongside 14 Pickware bundles.
Testing