Problem/Motivation
Given that we have Drupal core installed with the standard profile
And enabled "Language, Layout Builder, Contextual Links, Settings Tray" modules
And activated the "Use Layout Builder" and "Allow each content item to have its layout customized." on the default display mode for a selected content type
When we click on "Layout" to change the layout for a content page
Then we should not see the following error
But When we add "composer require 'drupal/layout_builder_modal:^1.0'"
And "composer require 'drupal/lb_ux:^1.0'"
And enable "Layout Builder Modal" and "Layout Builder UX" modules
Then we should see the fatal error
The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\Component\Utility\UrlHelper::buildQuery() must be of the type array, null given, called in /var/www/html/dev/drupal80801/web/core/modules/contextual/contextual.module on line 180 in Drupal\Component\Utility\UrlHelper::buildQuery() (line 42 of core/lib/Drupal/Component/Utility/UrlHelper.php).
Drupal\Component\Utility\UrlHelper::buildQuery(NULL) (Line: 180)
_contextual_links_to_id(Array) (Line: 139)
contextual_preprocess(Array, 'block', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('block', Array) (Line: 431)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array) (Line: 501)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 68)
__TwigTemplate_a02fc5fdb66ff3aaf13167043da76be28c60b348483b5d86e00a20c0c3be3b82->doDisplay(Array, Array) (Line: 455)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 422)
Twig\Template->display(Array) (Line: 434)
Twig\Template->render(Array) (Line: 64)
twig_render_template('core/themes/stable/templates/layout/layout--onecol.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('layout__onecol', Array) (Line: 431)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 694)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
So when any module is changing the context .. Array or string
The system should not have a fatal error. insted a worning log could be better. to let develpers know that the context values had been changed in a wrong way.
Proposed resolution
- Wrap with try catch and a warning logger and added the language to the message
Remaining tasks
- Automated tests
User interface changes
N/A
API changes
N/A
Data model changes
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #47 | 3101231-47.patch | 2.26 KB | waropd |
| #45 | 3101231-45.patch | 2.42 KB | michaelsoetaert |
| #44 | 3101231-44.patch | 2.44 KB | marcellinostroosnijder |
| #40 | 3101231-nr-bot.txt | 144 bytes | needs-review-queue-bot |
| #36 | 3101231-36.patch | 1.97 KB | qusai taha |
Issue fork drupal-3101231
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:
Comments
Comment #2
rajab natshahComment #3
rajab natshahComment #4
rajab natshahComment #5
rajab natshahComment #6
rajab natshahComment #9
rajab natshahComment #10
rajab natshahComment #11
rajab natshahComment #13
rajab natshahComment #14
rajab natshahComment #15
rajab natshahComment #17
davidferlay commentedFrom https://www.drupal.org/project/layout_builder_modal/issues/3101572#comme...
Remaining todo :
Comment #18
andypostPlease try this patch - it will show which group fails and then we could find why params is not initialized
The error in related issue shows that some contextual link wrongly build
there's typo `s/rout/route`
Comment #19
rajab natshahThank you Andrey for clearing
Comment #20
davidferlay commentedPatch from #19 tested and working @RajabNatshah :)
I'm glad the issue is moving forward
Comment #21
longwave@davidferlay If the patch is working for you, what is the exact warning message that is logged? That will help us fix the problem at the source.
Comment #22
davidferlay commentedHi @longwave,
The initial error I was encountering is described in detail here : https://www.drupal.org/project/layout_builder_modal/issues/3101572
Hope it helps
Comment #23
alexpottThanks for filing this bug report and for fixing it. Bug fixing is very valuable. However in order to commit a bug fix we need an automated to test to prove that we've fixed the bug and ensure that we don't break it again in the future. For more information about writing tests in Drupal 8 see the following links:
Also some steps to reproduce the problem would be great so we can see why the problem is happening and perhaps address the root cause rather than the symptoms.
Comment #24
rajab natshahComment #25
rajab natshahComment #26
rajab natshahComment #28
nwom commented#19 worked great and fixed my WSOD when attempting to edit the layout via Layout Builder on any content type or node. This was able to be successfully applied against 9.06.
Edit: Also works on 9.07
Comment #29
Greenman77 commentedI am now on Drupal 8.9.7 as the patch is to core I was unwilling to apply however disabling my layout modal at least allows to load the layout page.
Thanks @davidferlay for the hint #17 proceeding without layout modal module.
Comment #30
rajab natshahComment #31
rajab natshahComment #32
lendudePer #23 : "Also some steps to reproduce the problem would be great so we can see why the problem is happening and perhaps address the root cause rather than the symptoms."
We will really need some steps to reproduce this or a failing automated test that demonstrates the problem otherwise we have no idea if we are fixing a problem or just hiding a problem.
Comment #34
aspilicious commentedThe previous patch deleted to many contextual links.
I wasn't able to translate the inline blocks anymore with the core sync patch.
My version works but probably isn't perfect.
Comment #36
qusai taha commentedRe-roll patch #19 to be working with patch #143 from issue Admin toolbar and contextual links should always be rendered in the admin language (if set)
Comment #38
rajab natshahComment #40
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #42
webfaqtory commentedPatch for D10. Tested on D10.1.2
Comment #43
webfaqtory commentedI have the patch for "Allow synced Layout override Translations: translating labels and inline blocks" 2946333-d10-307.patch installed and there was no configure block icon when hovering over the block when using my 3101231-D10.patch.
I have fixed the missing $args['route_parameters'] (they are availabe in $contextual_links['layout_builder_block_translation'] or $contextual_links['layout_builder_inline_block_translation']) and everything now works.
Not sure that this is the best place for this fix so have also posted in the "Allow synced Layout override Translations: translating labels and inline blocks" issue queue. But it is here if anyone else has this problem.
Comment #44
marcellinostroosnijder commentedCredits to Gauravvvv, but added the patch to the wrong issue:
Comment #45
michaelsoetaertJust as comment #36, I use a patch from Admin toolbar and contextual links should always be rendered in the admin language (if set) and just encountered this issue. I've rerolled the patch from comment #44 to apply on the (latest) MR #4604.
Comment #46
joseph.olstadpatch #44 works on D10.4.6 however patch #45 fails to apply.
patch #44 works on D11.1.6 however patch #45 fails to apply.
Recommend continuing with patch #44 and ignoring patch #45
Patch #44 resolves the bug, prevents WSOD when using layout_builder on a node page in the other language.
Comment #47
waropd commented#44 & #45 wouldn't apply on 11.1.8
Comment #50
patriciacb commentedComment #51
smustgrave commentedThanks for reviving this issue. Unfortunately still need to add clear steps to reproduce to the summary. Also will need test coverage.
Comment #52
patriciacb commentedI have added patch #47, which was working fine.
Comment #53
rajab natshahComment #55
bbu23I'm in a bit of a hurry, but I updated the MR which mirrors the patch #47 to remove the unknown Client Exception, and adjust the route params fallback to an empty array. Tested with 11.3+ and layout_builder_st + layout_builder_modal. Enabling layout_builder_modal has caused the issue for me.