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

Condition rules result in errors on the edit forms #267

Closed
MoritzLost opened this issue Jul 4, 2024 · 3 comments
Closed

Condition rules result in errors on the edit forms #267

MoritzLost opened this issue Jul 4, 2024 · 3 comments
Assignees
Labels

Comments

@MoritzLost
Copy link
Contributor

Description

Adding a display condition to a field layout element that depends on a CKEditor field results in an error message:

Call to undefined method craft\ckeditor\data\FieldData::isEmpty()

The field seemingly provides condition rules for element queries, not for plain text fields. When the field is selected, the only two options are has a value and is empty:

entry-condition-ckeditor-field

Instead of the usual options you get when selecting a plain text field:

entry-condition-plaintext-field

On the entry form, the condition rule treats the $value as an element query or collection, that's causing an error.

Steps to reproduce

  1. Create a CKEditor field and any other field and add them both to an entry type's field layout.
  2. Add an entry condition to the second field that depends on the CKEditor field.
  3. Open the entry edit form.

Additional info

  • Craft version: 5.2.5
  • PHP version: 8.3
  • CKEditor version: 4.1.0
@i-just
Copy link
Contributor

i-just commented Jul 18, 2024

Hi, thanks for reporting! I raised PRs to address this.

At this point, the CKEditor field only supports the EmptyFieldConditionRule (“has a value”, “is empty”). Please post a new discussion if you think it should be extended beyond that.

@MoritzLost
Copy link
Contributor Author

@i-just Thanks! The condition rules for empty/non-empty fields are sufficient for me, the other substring options rarely make sense for CKEditor fields.

@brandonkelly
Copy link
Member

Craft 4.10.7 and 5.2.9 are out with that fix. Thanks again!

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