Problem/Motivation

node_add_body_field is being deprecated and Node also stopped the automatic creation of the body field.

Although it is possible to have several node types with a body field on a simple site (e.g. article and page in standard profile), while many node types may not have a body field, it's even less likely with blocks to have more than one with a body field - either you would only have one custom block type, or you'd have several with completely different fields and no body (entity reference, media etc.).

Additionally, we definitely shouldn't be creating a text_with_summary field because blocks don't have a concept of a 'teaser' or similar view mode in any meaningful way, so there is nowhere for the summary to be shown.

Steps to reproduce

NA

Proposed resolution

Deprecate block_content_add_body_field and stop automatic creation of body field.

Remaining tasks

Do it
Review

User interface changes

NA

Introduced terminology

NA

API changes

block_content_add_body_field is deprecated

Data model changes

NA

Release notes snippet

NA

Issue fork drupal-3535526

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

smustgrave created an issue. See original summary.

smustgrave’s picture

Status: Active » Needs review
acbramley’s picture

Issue summary: View changes
Status: Needs review » Postponed
Related issues: +#3489266: Deprecate node_add_body_field()

We should just wait until the node issue is done so we can reuse the trait here https://git.drupalcode.org/project/drupal/-/merge_requests/11194/diffs#8...

smustgrave’s picture

Sure, going to keep assigned to me then as I hope the blocker will land soon

smustgrave’s picture

Title: Deprecate block_content_add_body_field » Deprecate block_content_add_body_field and stop automatic creation of body field
Issue summary: View changes
smustgrave’s picture

Status: Postponed » Needs review

Blocker is in, I kept as removed in 12 as that was the same as node_add_body_field

acbramley’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

This is looking great, I tweaked the CR slightly and added the API changes to the IS.

dww’s picture

Status: Reviewed & tested by the community » Needs review

Mostly looks good. 1 minor question in the MR about if this is disruptive enough to defer removal for D13.

dww’s picture

Hah, that's what #9 said. But I think that previous removal was in 11.2 so the rules were different back then...

acbramley’s picture

@dww I think the rationale for removing in D12 is explained in #9

smustgrave’s picture

Yea don’t know best rule of thumb but the node-body ticket was set to 12 so just copied that

berdir’s picture

FWIW, while this is the same concept as node types technically, the situation and arguments for removing it (or not) are a bit different here:

For node types, the majority of sites at this point use alternative means to create the content: paragraphs, layout builder, experience builder. That's less of an issue. However, unlike node types, of which most need some kind of content, you're much less likely to need a second block type that has a body field. Also, I was surprised to find out that this does in fact also use text_with_summary, which makes even less sense here, because blocks don't really have a use case for a summary/teaser.

So I think it makes sense to remove this as well, but I think the issue summary should explain this better than "because node does it too".

Also, as commented in #3447617: Stop automatic storage creation of body field for node, I don't think this should block that. Either it should have it's own issue doing that or we should do it all here, but then we'd want to postpone this on that, so that we can copy the approach and figure out what needs to be done exactly first with node.

smustgrave’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Tried to tweak the summary some. Going to keep the scope as is and not remove the storage file just yet as it will overly complicate this one.

catch’s picture

Issue summary: View changes

Updated the issue summary with a bit more info.

  • catch committed 2440f482 on 11.x
    Issue #3535526 by smustgrave, acbramley, dww, berdir: Deprecate...
catch’s picture

Status: Reviewed & tested by the community » Fixed

This looks fine to me. Do we need a block-specific follow-up to also look at removing the default field config (that still uses text_with_summary) or is that covered somewhere in the general 'deprecate text_with_summary' metas somewhere?

Agreed that the deprecation should be fine for 12.x, this is only used in one place in core outside tests and the usage inside tests is pretty minimal.

Committed/pushed to 11.x, thanks!

catch’s picture

Issue tags: +Needs followup

Tagging for follow-up, if there's an existing issue, would be good to add it to the related issues.

acbramley’s picture

Should this issue be retitled as it sounds like we haven't removed the auto creation yet? one is storage, one is field all good

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.