Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x]: removing a field that is included in a show-rule of another field, causes an error in CP entry view #14838

Closed
krizzzly opened this issue Apr 20, 2024 · 3 comments
Assignees
Labels

Comments

@krizzzly
Copy link

What happened?

Description

Error: Invalid field layout element UUID:

Steps to reproduce

  1. create 2 fields (lightswitch and input) inside a matrix element
  2. input only shows when lightswitch is on
  3. add matrix field to entry
  4. remove lightswitch field from field layout
  5. open cp url of entry again

Expected behavior

Actual behavior

Craft CMS version

5

PHP version

8

Operating system and version

linux

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@krizzzly krizzzly added the bug label Apr 20, 2024
@brandonkelly brandonkelly self-assigned this Apr 20, 2024
@brandonkelly
Copy link
Member

I’m not able to reproduce this, and have tried with each of the Matrix view modes. I’ve also tried adding the fields directly to the top level entry type’s field layout.

Can you search for the error in storage/logs/ and post the stack trace that follows?

@mmikkel
Copy link
Contributor

mmikkel commented May 17, 2024

I just ran into what I believe is the same issue (Craft 5.1.3). It's not really related to Matrix per se; it's something that happens when a field that is used in a field layout conditional, is removed from the layout.

Steps to reproduce:

  1. Create two plain text fields "Field A" and "Field B", and add them both to a field layout.
  2. Add an entry condition on "Field B": Field A has a value
  3. Save the entry type. Create an entry that uses the relevant entry type.
  4. Edit the entry type, remove "Field A" and re-save the entry type.
  5. Visit the entry's edit page

Same error is also thrown if the user attempts to open up "Field B"'s field layout settings after having saved the layout without "Field A", making it impossible to remove the redundant/offending conditional. To fix it, Field B has to be removed from the layout before re-saving the entry type and re-adding Field B.

Stack trace: https://pastebin.com/Km9tz3nC

@brandonkelly
Copy link
Member

Thanks @mmikkel! I was able to reproduce following that, and got it fixed in Craft 5.1.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants