Change createBodyField from making text_with_summaty

Created on 2 August 2025, 6 days ago

Problem/Motivation

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

field system

Created by

πŸ‡ΊπŸ‡ΈUnited States smustgrave

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

Merge Requests

Comments & Activities

  • Issue created by @smustgrave
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Probably postponed on a few steps.

  • Pipeline finished with Failed
    6 days ago
    Total: 707s
    #562912
  • Pipeline finished with Failed
    6 days ago
    Total: 185s
    #562918
  • Pipeline finished with Failed
    6 days ago
    Total: 262s
    #562925
  • Pipeline finished with Failed
    6 days ago
    Total: 1442s
    #562931
  • Pipeline finished with Failed
    6 days ago
    Total: 243s
    #562933
  • Pipeline finished with Success
    6 days ago
    Total: 722s
    #562935
  • πŸ‡ΊπŸ‡ΈUnited States nicxvan
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    This was smaller then I thought so may be good to go now

  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    I find it suspicious that \Drupal\Tests\node\Kernel\NodeTokenReplaceTest::testNodeTokenReplacement doesn't need a change. That probably works because it never reloads the node, so the summary is set as an undefined property and the token works.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    With regards to TextWithSummaryCreationTrait I did make that before I started fixing tests but shouldn't we offer a replacement for those who may have been relying on createBodyField to make a text_with_summary?

  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    > those who may have been relying on createBodyField to make a text_with_summary?

    createBodyField was introduced in πŸ“Œ Deprecate node_add_body_field() Active , as a replacement for node_add_body_field(), that's a non-issue, but you can of course ask the same question about node_add_body_field(). But that's not really a problem IMHO. There are going to be very, very few cases that specifically want a summary field. We'd need to deprecate and move this trait again to text_with_summary module, and then those contrib module would need to depend on that.

    In all my contribs in my project, I see 7 calls or so to node_add_body_field(), I doubt any of them care about the summary. In contrast to that, there are 200+ calls to FieldStorageConfig::create() where tests set up their own fields explicitly. Which I think is where we want to go.

    Same with core really, I don't even see any calls to createBodyField() except the one in createContentType(). Maybe there were and we refactored them away in that issue and shouldn't have introduced that trait and method at all? Core has 400+ FieldStorageConfig::create() calls where it sets up specific fields with specific configuration. We keep the concept of a "body" field being a default thing of a node type in tests while removing this on actual sites, that should IMHO be an intermediate step just to deal with the amount of tests relying on it for one reason or another.

    Instead, what I think we should do is introduce an API version of \Drupal\Tests\field_ui\Traits\FieldUiTestTrait::fieldUIAddNewField(). That uses the UI, but most cases don't actually want to test the UI with this, they just want a field with a given name, type and configuration for their entity type.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Fair enough, I pushed the changes up but this will actually be postponed on πŸ“Œ Stop automatic storage creation of body field Active , added the code that will have to be un-commented out once that lands

  • Pipeline finished with Failed
    4 days ago
    Total: 140s
    #564481
Production build 0.71.5 2024