Skip to content

fix: preserve other plugins' scripts in administration_login_scripts block#74

Open
nyxthelobster wants to merge 1 commit into
runelaenen:masterfrom
nyxthelobster:fix/admin-login-scripts-parent
Open

fix: preserve other plugins' scripts in administration_login_scripts block#74
nyxthelobster wants to merge 1 commit into
runelaenen:masterfrom
nyxthelobster:fix/admin-login-scripts-parent

Conversation

@nyxthelobster

Copy link
Copy Markdown

Problem

src/Resources/views/administration/index.html.twig overrides the administration_login_scripts block 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_SERIALIZED via administration_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.Pickware exists, no console errors - the modules just never register because their feature flags are missing.

Fix

  • Call {{ parent() }} at the beginning of the block so content contributed by other plugins is preserved
  • Use {% sw_extends %} so Shopware's template inheritance chain (which supports multiple plugins extending the same template) is used

The 2FA login override itself keeps working exactly as before - verified in production alongside 14 Pickware bundles.

Testing

  • Verified on Shopware 6.7.11.1 in production
  • 2FA login flow still works (login script override intact)
  • Pickware admin UI restored (feature flag script present again in admin HTML)

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant