Skip to content

[5.x]: Deleting fields that other fields have conditions on causes errors #15328

@MoritzLost

Description

@MoritzLost

What happened?

Description

In the field layout editor, deleting a field causes issues if you have another field that has a condition that depends on the deleted field. After deleting the field, double-clicking the field with the condition (or using … → Settings) shows an error notification:

Invalid field layout element UUID:

invalid-field-layout-element

Steps to reproduce

  1. Add two fields to an entry field layout.
  2. In the settings of the second field, add any condition that points to the first field.
  3. Delete the first field and save the field layout.
  4. Try to open the settings for the second field.

Expected behavior

Deleting a field should either:

  • automatically delete any conditions that other fields have in relation to the deleted field, and display a corresponding warning/info message.
  • prevent the deletion of the field until all conditions that depend on the field are removed manually.

Actual behavior

The field layout ends up in an erroneous state with no clear path to recover from the error.

Craft CMS version

5.2.5

PHP version

8.3

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions