- Issue created by @svdhout
- ๐ง๐ชBelgium svdhout
it looks like the feature for "3195679 - Provide default options for each content type" is causing this.
Because $node_type->id() does not yet have an identifier when creating a new content type. - ๐ง๐ชBelgium StefanieV
I'm having the same problem on 2.2.1.
For a workaround: commenting out the code in node_keep_form_node_type_form_builder() temporarily allowed me to create the content type, after which I could go back, select the node keep options for the content type and save them. - ๐ง๐ชBelgium jasdeba
Bumping the priority as this is blocking the development of new projects.
- ๐ฎ๐ณIndia SandeepSingh199
Yes. In form_alter we canโt get $node_type->id(). I think while creating a new Content Type we donโt need panel like Node Keep defaults , instead of that after Content Type created, we can add that functionality in Manage Form Display.
For now if we remove that two functions node_keep_form_node_type_form_alter() & node_keep_form_node_type_form_builder() module's functionality is working fine.
Attaching a patch file. - ๐ง๐ชBelgium seutje Antwerp
Patch in #5 doesn't apply as it was created within a project instead of from the module root (references a/modules/contrib/node_keep/node_keep.module instead of a/node_keep.module).
Attached patch fixes that and also removes the
use Drupal\node\NodeTypeInterface;
statement.It basically just reverts commit a41352e3, so it's not meant to be a permanent solution, just a stop-gap until this issue can be resolved.
- First commit to issue fork.
- Merge request !13Issue 3387330 Fix fatal crash on creating new node type. โ (Merged) created by andreasderijcke
- Status changed to Needs review
12 months ago 4:43pm 4 January 2024 - ๐ง๐ชBelgium andreasderijcke Antwerpen / Gent
The reason for the observed error, is that the node type entity fetched from the form state isn't updated yet, while the type entity given to the callback already is. Changing that in the code, exposes the underlying problem:
When creating a new node type, is trying to create/update base field values node_keep_form_node_type_form_builder.
When the node type already exists, this will create a base field override.
If the node type is new, it will try to create a new base field definition, which is should not, and for which it is missing info.Moving this part to a submit handler, run last, fixes the problem.
Please test/review.
- Status changed to RTBC
11 months ago 8:15am 30 January 2024 - ๐ง๐ชBelgium ant1
MR !13 seems to fix this issue. Bumped to RTBC for visibility.
- First commit to issue fork.
- Status changed to Fixed
11 months ago 10:15am 7 February 2024 - ๐บ๐ฆUkraine nginex
Thanks for the patch, I will include it to a new release in a moment
Automatically closed - issue fixed for 2 weeks with no activity.