Attempt to create a base field bundle override of field node_keeper without a bundle

Created on 14 September 2023, 10 months ago
Updated 21 February 2024, 4 months ago

When adding a new content type, the following error is thrown, the content type is not created.

> Attempt to create a base field bundle override of field node_keeper without a bundle

๐Ÿ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

๐Ÿ‡ง๐Ÿ‡ชBelgium svdhout

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • 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.
  • Status changed to Needs review 6 months ago
  • ๐Ÿ‡ง๐Ÿ‡ช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 5 months ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium antoineh Mechelen, ๐Ÿ‡ง๐Ÿ‡ช

    MR !13 seems to fix this issue. Bumped to RTBC for visibility.

  • First commit to issue fork.
  • Status changed to Fixed 5 months ago
  • ๐Ÿ‡บ๐Ÿ‡ฆ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.

Production build 0.69.0 2024