Generated with the help of an LLM.

Problem/Motivation

After a Content Builder field is deleted, cron fails while purging its values. The field is never purged, so uninstalling the module is refused with "Fields pending deletion".

This happens when the File module is installed. Purging the field releases the file usage of its inline images, which reads its sections. Core passes a deleted field's values back still serialized, and the section property rejects them.

Steps to reproduce

  1. Make sure the File module is installed.
  2. Add a "Content builder" field to the "Basic page" content type.
  3. Create a basic page with one section and save it.
  4. Delete the field on Manage fields.
  5. Run cron, for example drush cron.
  6. Try to uninstall Content Builder. It is refused with "Fields pending deletion".

The cron error is in Reports › Recent log messages (trimmed):

InvalidArgumentException: Value assigned to "section" is not a valid section
#0 core/modules/layout_builder/src/Plugin/DataType/SectionData.php(38)
#1 core/lib/Drupal/Core/TypedData/TypedDataManager.php(220)
#2 core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php(125)
#3 modules/contrib/content_builder/src/Field/ContentBuilderItemList.php(92)
#4 modules/contrib/content_builder/src/Field/ContentBuilderItemList.php(432)
#5 modules/contrib/content_builder/src/Field/ContentBuilderItemList.php(450)
#6 modules/contrib/content_builder/src/Field/ContentBuilderItemList.php(393)
#7 core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(576)
#8 core/lib/Drupal/Core/Field/FieldPurger.php(100)
…

Proposed resolution

Unserialize sections that arrive serialized, allowing only the section classes.

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

Comments

gloriaswebtech created an issue. See original summary.

  • gloriaswebtech committed 999f1a53 on 1.0.x
    Issue #3637513 by gloriaswebtech: Purge deleted content builder fields...
gloriaswebtech’s picture

Status: Active » Fixed

Fixed in 1.0.2

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.