- Issue created by @joseph.olstad
- π¨π¦Canada joseph.olstad
Possible lead to a fix.
Steps to reproduce:
- Fresh install of Drupal 10.4.6
- Set french as original language (site default language)
- Add english as a second language option
- configure language negotiation using a two letter prefix
- install layout_builder_st
- configure a bundle like article or basic page to have translation enabled
- create a node, then try to edit the layout on one node in english (the second language)
Exception occurs
- edit the layout on the same node using french (the original/site default language), no error , able to edit the layout without exception.
see screenshot:
βexception message follows: (from core)
The website encountered an unexpected error. Try again later. TypeError: Drupal\Component\Utility\UrlHelper::buildQuery(): Argument #1 ($query) must be of type array, null given, called in /docroot/html/core/modules/contextual/contextual.module on line 178 in Drupal\Component\Utility\UrlHelper::buildQuery() (line 42 of core/lib/Drupal/Component/Utility/UrlHelper.php).
- π¨π¦Canada joseph.olstad
My guess is, something in core changed between Drupal 9.5 through to Drupal 10.4 / Drupal 11.1 causing this exception to be thrown.
- π¨π¦Canada Liam Morland Ontario, CA π¨π¦
liam morland β made their first commit to this issueβs fork.
- First commit to issue fork.
- heddn Nicaragua
The easy fix was to pull in π Contextual links for translation are removed by core Active . However, I'm fully convinced that one of
- π Circular dependency between bundle and data type info Active
- #3011137: Merge TypedDataManager and TypedConfigManager β
- π Calling TypedConfigManager::create() does not use the definitions of TypedConfigManager (config schema), but of TypedDataManager (field types) Active
are being faced. In
TranslateBlockForm::createTranslationElement
, we interact with TypedData and that triggers validations of TypedConfigManager plugins in TypedDataManager. I'm not sure how to solve this. For now posting my findings.You too can reproduce this on a 10.4 or later site and this module.
drush en -y content_translation layout_builder_st field_ui
- Add a second language: admin/config/regional/language/add
- Enable translations for Content => Basic page content type: admin/config/regional/content-language
- Configure view display to use layout builder and have customized displays: admin/structure/types/manage/page/display
- Add a node and translate it: node/add/page & node/1/translations
- Attempt to edit any of the layout blocks via contextual links on the translation node/1/layout
- heddn Nicaragua
If you patch core with the attached test, something between 10.2.0 and 10.3.0 broke. This is the logic that lb_st is trying to do.
index a7048f38eef..d9438019a39 100644 --- a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php +++ b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php @@ -9,6 +9,7 @@ use Drupal\Core\TypedData\DataDefinition; use Drupal\Core\TypedData\ListDataDefinition; use Drupal\Core\TypedData\MapDataDefinition; +use Drupal\Core\TypedData\Plugin\DataType\StringData; use Drupal\Core\TypedData\Type\BinaryInterface; use Drupal\Core\TypedData\Type\BooleanInterface; use Drupal\Core\TypedData\Type\DateTimeInterface; @@ -697,4 +698,24 @@ public function testTypedDataValidation(): void { $this->assertSame('0.value', $violations[0]->getPropertyPath()); } + public function testTypedDataGet(): void { + $this->enableModules([ + 'layout_builder', + 'layout_discovery', + 'block', + 'contextual' + ]); + $type_definition = $this->container->get('config.typed') + ->getDefinition('block.settings.inline_block:*'); + $definition = new $type_definition['definition_class']($type_definition); + $definition->setClass($type_definition['class']); + $typed_data = $type_definition['class']::createInstance($definition); + $typed_data->setValue([ + 'id' => 'inline_block:basic', + 'label' => 'Test Title', + ]); + $label_data = $typed_data->get('label'); + $this->assertInstanceOf(StringData::class, $label_data); + } + }
- heddn Nicaragua
The trick seems to be adding
$definition->setTypedDataManager($this->typedConfigManager);
in the form class. Manually testing and executing tests locally, things are now passing green again. Oh, I also had to fix some of the tests.However, π Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay class does not correspond to an entity type. Needs work is biting us from upstream so tests are again not passing green on the testbot.
- π¨π¦Canada joseph.olstad
Hmm, ok strange so you've fixed the Drupal 10.4.x testing somehow.
However Drupal 11 testing results is curiously vastly different. Perhaps since it's testing against 11.x-dev instead of 11.1.8 or 11.2.2?
If we're testing off of 11.x there is a higher chance of seeing turbulence when compared to say testing against 11.1.8 or 11.2.2.
The Drupal 11 pipelines show 14 failures in the most recent run.
Not sure if this is of any help however we have been successfully using layout_builder_st dev-2.0.x 68f690c8fb with Drupal 11.1.8 extensively with this concoction of patches:
"drupal/layout_builder_st": { "3411037 - Fix core removing contextual translation links": "https://git.drupalcode.org/project/layout_builder_st/-/merge_requests/5.patch", "3420063 - Call to a member function getConfig() OverridesSectionStorage.php": "https://git.drupalcode.org/project/layout_builder_st/-/merge_requests/6.diff", "3069964 - Null fix for moderation dashboard, otherwise WSOD on login": "https://www.drupal.org/files/issues/2025-01-02/3069964-null-fix.patch" },
Others outside of my groups have builds with layout_builder_st dev-2.0.x with a variety of patches applied and using Drupal 11.1+
Wondering why Drupal 11..x-dev testing would suddenly show 14 pipeline failures. Previously there were 3 with 22 skips, maybe because now there's only 21 skipped? Maybe the non-skipped test has a lot of failures now that it's no longer skipped?
Prior to recent changes;
Tests: 38, Assertions: 1100, Errors: 1, Failures: 3, PHPUnit Deprecations: 1, Skipped: 22.
https://git.drupalcode.org/project/layout_builder_st/-/jobs/5051465Latest pipeline run:
Tests: 38, Assertions: 98, Errors: 14, PHPUnit Deprecations: 60, Skipped: 21.
https://git.drupalcode.org/project/layout_builder_st/-/jobs/5051465 - π¨π¦Canada joseph.olstad
@heddn, great work, seems like you've pushed things further along!
- heddn Nicaragua
This goes a long way to improving tests. There are still failing tests, but they are blocked on π Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay class does not correspond to an entity type. Needs work landing upstream.
Automatically closed - issue fixed for 2 weeks with no activity.
- π¨π¦Canada joseph.olstad
Serious chaos has happened with layout_builder_st
we had @phenaproxima running things, he ended up doing a build of 2.0.x that we have been using successfully with Drupal 11.1.8Now I see the latest 2.0.x won't even run testing as it says this:
8) Drupal\Tests\layout_builder_st\Functional\Rest\LayoutBuilderEntityViewDisplayJsonBasicAuthTest::testGet Unable to install modules: module 'layout_builder_st' is incompatible with this version of Drupal core.
@phenaproxima basically did some heavy modifications from 1x to 2.0.x. It was functional and we have been using it since several months. However there's now been a major reversal on the approach, a new maintainer, did you guys even have a discussion before handoff .
Here's what we have been using with Drupal 11.1.8
"name": "drupal/layout_builder_st", "version": "dev-2.0.x", "source": { "type": "git", "url": "https://git.drupalcode.org/project/layout_builder_st.git", "reference": "68f690c8fb7a679128deaa22bc3d5f0272caec18" }, "require": { "drupal/core": "^10 || ^11" },
with these patches
"drupal/layout_builder_st": { "3411037 - Fix core removing contextual translation links": "https://git.drupalcode.org/project/layout_builder_st/-/merge_requests/5.patch", "3420063 - Call to a member function getConfig() OverridesSectionStorage.php": "https://git.drupalcode.org/project/layout_builder_st/-/merge_requests/6.diff", "3069964 - Null fix for moderation dashboard, otherwise WSOD on login": "https://www.drupal.org/files/issues/2025-01-02/3069964-null-fix.patch" },