craftcms / craftcms/cms

[5.x]: Some ambiguity regarding entry conditions

Open
#14,919 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

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:

  1. Two sections, Home and Pages
  2. Two entry types, Matrix Type and Page Type
  3. Two fields, Plain Text and Matrix
  4. One user group, Group
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked craft-example reproduction project and compare the documented Current User Condition and Entry Condition setups against the behavior in Craft CMS 5.1.0. Verify the expected visibility of the Foobar panel and Matrix Type field for the Group user and Home/Pages sections; the issue is ready for closure only once the intended condition semantics and observed behavior agree.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
backend, content
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.