You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EDIT:
I have realized a major mistake on my part which is that users have sections for "Current User Condition" AND "User Condition". I used the wrong section and the user conditions are working as expected.
I'm also starting to wonder if the Matrix conditional is potentially an issue of ambiguous language and a fundamental difference between how Neo handles field conditionals and how matrix blocks in Craft 5 handle them. Where the "Entry Condition" options don't apply to the OWNER, but to the matrix entry type itself. However, if that is the case, I don't understand the existence of the "Entry Type" option in the dropdown since, as far as I can tell, this would NEVER change.
Description
Feeling a bit crazy here because no one else has reported. But all my tests point to certain field conditions just not working. Below is a link to a repo for reproduction—project was setup using instruction at https://craftcms.com/docs/5.x/install.html. There may be more, but these are the two cases I've tested.
There is a field layout panel called "Foobar" for users with a single field and the following condition:
Current User Condition: "User Group" "is one of" "Group"
Second conditional issue:
The "Matrix Type" entry type has a single, plain text field, "Field", and the following condition:
Entry Condition: "Section" "is one of" "Pages"
The "Matrix" field allows "Matrix Type" entry types as elements, has been added to the "Page Type" entry type, and "Page Type" is assigned to both the "Home" and "Pages" sections.
Expected behavior
First conditional issue:
When a user belongs to the "Group" user group, the "Foobar" field layout tab would display when editing that user.
Second conditional issue:
When adding matrix blocks to the "Home" section, the "Field" field on the matrix block should not display.
When adding matrix blocks to the "Pages" section, the "Field" field on the matrix block should not display.
Actual behavior
First conditional issue:
If you add a user to the User Group "Group" and edit that user the "Foobar" panel does not display.
Second conditional issue:
When adding instances of the "Matrix Type" in the "Matrix" field for a "Page Type", the plain text field does not appear for either the "Home" or "Pages" sections.
Craft CMS version
5.1.0
PHP version
8.3
Operating system and version
Linux 6.7.11
Database type and version
MySQL 8.0.33
Image driver and version
Imagick 3.7.0
The text was updated successfully, but these errors were encountered:
I think the described behaviour is not a bug, it's just that conditions here do not work as you expect them to:
The "Current User Condition" applies to the user editing the current element. So if you are editing a user, you should be in the "Group" user group to display the "Foobar" tab. You should use the "User Condition" instead.
Likewise the "Entry Condition" applies to the current entry. In your case that is the Matrix block, not the parent entry. I agree that is perhaps a little confusing. I also think it would be usefull to add a new "Parent Entry Condition" for nested elements.
@thupsi All good. I think you're right in that I was mistaken about this being a bug, but I do think there may be an issue here to address regarding the Entry Condition given the one-two punch of ambiguous language and the number of people that will be coming from Neo where you could set conditions based on the block owner.
Also still really perplexed by the "Entry Type" option if this is the expected functionality, but I do think that being able to apply conditions based on the owner of an entry type within a field would be extraordinarily helpful. Though, this may just be an argument to continue using Neo blocks (presuming they still have this feature in Craft 5). Given the architectural changes in Craft 5, I would not be surprised to find out it is a non-trivial addition to allow conditions based on "owner" since I'm not entirely sure the concept of an owner carries over here.
That said, there are a ton of use cases for this and would love to see the ability to allow matrix fields to be conditional based on the context of the matrix field itself.
corneliusio
changed the title
[5.x]: At least some conditions seem broken
[5.x]: Some ambiguity regarding entry conditions
May 1, 2024
What happened?
EDIT:
I have realized a major mistake on my part which is that users have sections for "Current User Condition" AND "User Condition". I used the wrong section and the user conditions are working as expected.
I'm also starting to wonder if the Matrix conditional is potentially an issue of ambiguous language and a fundamental difference between how Neo handles field conditionals and how matrix blocks in Craft 5 handle them. Where the "Entry Condition" options don't apply to the OWNER, but to the matrix entry type itself. However, if that is the case, I don't understand the existence of the "Entry Type" option in the dropdown since, as far as I can tell, this would NEVER change.
Description
Feeling a bit crazy here because no one else has reported. But all my tests point to certain field conditions just not working. Below is a link to a repo for reproduction—project was setup using instruction at https://craftcms.com/docs/5.x/install.html. There may be more, but these are the two cases I've tested.
https://github.com/corneliusio/craft-example
Project has the following:
Steps to reproduce
First conditional issue:
There is a field layout panel called "Foobar" for users with a single field and the following condition:
Current User Condition: "User Group" "is one of" "Group"
Second conditional issue:
The "Matrix Type" entry type has a single, plain text field, "Field", and the following condition:
Entry Condition: "Section" "is one of" "Pages"
The "Matrix" field allows "Matrix Type" entry types as elements, has been added to the "Page Type" entry type, and "Page Type" is assigned to both the "Home" and "Pages" sections.
Expected behavior
First conditional issue:
When a user belongs to the "Group" user group, the "Foobar" field layout tab would display when editing that user.
Second conditional issue:
When adding matrix blocks to the "Home" section, the "Field" field on the matrix block should not display.
When adding matrix blocks to the "Pages" section, the "Field" field on the matrix block should not display.
Actual behavior
First conditional issue:
If you add a user to the User Group "Group" and edit that user the "Foobar" panel does not display.
Second conditional issue:
When adding instances of the "Matrix Type" in the "Matrix" field for a "Page Type", the plain text field does not appear for either the "Home" or "Pages" sections.
Craft CMS version
5.1.0
PHP version
8.3
Operating system and version
Linux 6.7.11
Database type and version
MySQL 8.0.33
Image driver and version
Imagick 3.7.0
The text was updated successfully, but these errors were encountered: