Reproduce:
1. Create CSS Injector
2. Flush caches, open page source and see the custom asset injector CSS loaded
3. Enable maintenance mode
4. Check page source, asset is not loaded
When in maintenance mode, there's new class created in the body `.maintenance-page` that we want to use with the asset injector.
Thanks
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | asset_injector-3418928-not-working-in-8.x-2.20.patch | 1.37 KB | hswong3i |
Issue fork asset_injector-3418928
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3418928-not-working-in
changes, plain diff MR !14
Comments
Comment #3
pookmish commentedComment #4
hswong3i commentedI get following error message once fetching the latest 8.x-2.x-dev:
NOTICE: PHP message: Uncaught PHP Exception TypeError: "Drupal\Core\Render\Renderer::addCacheableDependency(): Argument #1 ($elements) must be of type array, null given, called in /var/www/html/modules/contrib/asset_injector/asset_injector.module on line 153" at /var/www/html/core/lib/Drupal/Core/Render/Renderer.php line 768After rolling back the patch, issue get fixed:
Comment #6
hswong3i commentedComment #7
pookmish commented@hswong3i, This sounds like you have something else going on. In the 8.x-2.x version, line 153 is a comment and the only thing added in the commit was adding a hook_preprocess_maintenance_page which works exactly like it's supposed to when using a base installation. You should debug your code first.
Comment #8
anybody@hswong3i any further details here? Can we set this fixed again?
Comment #9
hswong3i commentedComment #10
hswong3i commentedComment #11
pookmish commentedI added a unit test for the maintenance mode page assets. It works as expected. @hswong3i, if your site is sending "null" into the hook_preprocess_maintenance_page then you have other things that are breaking the functionality. Even Drupal core expects an array in the hooks for claro and olivero themes.