- Issue created by @msnassar
- Status changed to Needs review
about 1 year ago 7:15pm 14 November 2023 - last update
about 1 year ago 2 pass - Status changed to Needs work
8 months ago 6:00pm 26 April 2024 - 🇩🇪Germany szeidler Berlin
The problem indeed exist. Without a return nothing will happen. But why do you have the assumption in your patch that
hook_gutenberg_node_type_route()
returns an array? Shouldn't that return simply the content type as a string? - Status changed to RTBC
8 months ago 6:06pm 26 April 2024 - 🇩🇪Germany szeidler Berlin
No, you're right. Since it's not an alter, but invokeAll. The the approach is actually absolutely alright.
- Status changed to Needs work
8 months ago 8:16pm 26 April 2024 - 🇩🇪Germany szeidler Berlin
I still have problems to see how this can work.
getGutenbergNodeTypeFromRoute
if ($node_type) { // Then just return it. return $node_type->get('type'); }
$node_type is
group:request
for me and since the condition does not check if it's an NodeType object and fails withError: Call to a member function get() on string in Drupal\gutenberg\GutenbergContentTypeManager->getGutenbergNodeTypeFromRoute() (line 120 of modules/contrib/gutenberg/src/GutenbergContentTypeManager.php).
- 🇨🇭Switzerland colorfield Lausanne
#2 works for me, we might just make it clearer in the example hook, to use
entity.group_relationship.create_form
instead ofentity.group_content.create_form
and ensure that the plugin is fromgroup_node
. Updated the patch with this.Also, not sure if we should account the weight of the hooks here, but taking the first available hook that implements it for a Gutenberg enabled node type looks good.
For #7, it might indeed be that the route received a scalar parameter instead of the object because the route probably does not implement options parameters. So we could just check for
NodeTypeInterface
andNodeInterface
here. - Status changed to Needs review
6 months ago 5:25pm 12 June 2024