Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
sites\default\services.yml
twig.config: debug: true, auto_reload: true, cache: false
Colorbox is a image field formatter for node. On the page of the node message:
Notice: Undefined index: theme_hook_original in twig_render_template() (line 78 of core\themes\engines\twig\twig.engine).
twig_render_template('modules/contrib/colorbox/templates/colorbox-formatter.html.twig', Array)........
Comment | File | Size | Author |
---|---|---|---|
#16 | colorbox-8.x-1.0-fix-for-deleted-theme-hook-original-2626466-16.patch | 842 bytes | vitalie |
#9 | colorbox-fix-for-deleted-theme-hook-original-2626466.patch | 740 bytes | gausarts |
|
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedJon-Snow created an issue. See original summary.
Comment #2
serg2 CreditAttribution: serg2 commentedSame issue occurring for me. Would any other info be helpful?
Comment #3
terribeausejour CreditAttribution: terribeausejour commentedMy under development site in Drupal 8 has a problem - WSOD when attempting to display individual nodes. In viewing php errors, I see this: Notice: Undefined index: theme_hook_original in twig_render_template() (line 89 of /srv/bindings/79398a211a33497587f1f5c3f7af5e93/code/core/themes/engines/twig/twig.engine). I also see these notices: Notice: Undefined index: linked in linked_field_entity_display_build_alter() (line 174 of /srv/bindings/79398a211a33497587f1f5c3f7af5e93/code/modules/linked_field/linked_field.module).
Could this be causing the WSOD on node index display? Note, I disabled the linked field module thinking that module could be causing the issue, but it does not resolve the WSOD to do so. --Please advise, and guidance greatly appreciated.
Comment #4
serg2 CreditAttribution: serg2 commented@terribeausejour In my case there was no WSOD. Once I set twig debug to false the issue doesn't appear so maybe you could use that to check, or alternatively disable and un-install the module to see if it is the cause.
Comment #5
terribeausejour CreditAttribution: terribeausejour commentedThanks for the tip on disabling twig debug. I agree now that the WSOD is originating elsewhere. That issue remains unresolved (for me) but I will post elsewhere on that as needed.
Comment #6
terribeausejour CreditAttribution: terribeausejour commentedHas anyone been able to eliminate this error while twig debug is enabled? It is ugly and distracting to have this during debugging and also makes it difficult to demo the site for the client without repeatedly having to disable/enable twig debugging during development phase. Note, for me it is only posted when not logged in, if that is helpful.
Any guidance would be appreciated.
Terri
Comment #7
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedI will have a look and see if I can reproduce and fix this bug, hang tight.
Comment #8
DarkstarTom CreditAttribution: DarkstarTom commentedI'm having the same problem, but again only when twig debugging is turned on and I am not logged into the site. A fix would be appreciated. Thanks.
Comment #9
gausarts CreditAttribution: gausarts commentedThis doesn't happen when viewed as admin, but does when anonymous and only happens once on the first page load.
Reproduction
Like the OP, I also have: debug: true, auto_reload: true, but cache: true.
As the notice said:
The underlying problem is
template_preprocess_colorbox_formatter()
removed the variables theme_hook_original needed bytwig_render_template()
:$variables = array(); // Reset the $variables parameter.
Attached a simple fix to bring back the deleted variables and shut up the notice ;)
Comment #11
frjo CreditAttribution: frjo commented@gausarts thanks for tracking this down! I think an even easier solution is to simply delete the line that resets "$variables", it is a leftover from D7.
I have committed that fix now to 8.x-1.x. Reopen if there are any problems.
Comment #12
gausarts CreditAttribution: gausarts commentedThank you.
I am currently working with Blazy and colorbox integration, and found another issue with the missing variable URL specific for anonymous users again due to such aggressive variables reset.
Removing that line fixes the problem elsewhere ;) A lot more flexible. Thanks.
Comment #14
terribeausejour CreditAttribution: terribeausejour commentedI know this issue is closed, however. I referred back to it in order to apply the patch. In doing so, I found that the patch is for colorbox.theme.inc but the code that is to be patched is now in colorbox.inc. Just thought I'd give a heads up in case anyone else runs into this. Perhaps an update to the patch would be helpful as well...
Thanks very much for patching this, it is much appreciated.
Terri
Comment #15
agoradesign CreditAttribution: agoradesign commentedThe file was renamed in an earlier commit, so the patch is fine. As the patch is also already committed, I'd recommend you to switch to the dev version, until the next version is released.
Comment #16
vitalie CreditAttribution: vitalie commentedRe-rolled patch in #9 for 8.x-1.0 for those who prefer to patch the stable release.
Comment #17
Peter van den Heuvel CreditAttribution: Peter van den Heuvel commentedPatch from commet #16 worked fine for me. Thanks for the efford!
Comment #18
costellofax CreditAttribution: costellofax as a volunteer commentedPatch from #16 worked for me, thank you!!