Skip to content

[5.x]: Link field type condition bug #17741

@KlingeSean

Description

@KlingeSean

What happened?

Description

I have found an bug with the Link field.
When i want to set a condition on the type of the Link, the condition does not save and does not work.
I have provided a video underneat

Craft.5.8.15.Bug.Link.Field.Conditionals.mp4

Steps to reproduce

  1. go to an entrytype with a link field and any other field
  2. try to add a Entry Condition rule for the link field with condition "is of type" and add a type
  3. press apply

Expected behavior

The field you add the condition to keeps the condition correctly and dissapears or shows when conditions are met

Actual behavior

Condition isn't saved. and the conditions do not work.

Possible error

I noticed the field in the select for types has the name of "hrsjguhkkx[elementCondition][conditionRules][1][linkType]".
However every other conditions have the name of "hrsjguhkkx[elementCondition][conditionRules][1][value]"

and indeed when i check the payload the value is empty:

"conditionRules": [
                {
                    "class": "craft\\fields\\conditions\\LinkFieldConditionRule",
                    "uid": "40b2599a-f9f8-4ad8-9698-08c1e36929d5",
                    "operator": "type",
                    "value": "",
                    "fieldUid": "8d881ed8-a8cf-4d48-b9c0-811f48943040",
                    "layoutElementUid": "6df38ffe-a6ec-430c-88fe-c70c3181dfe7"
                }
            ]

Craft CMS version

5.8.15

PHP version

8.2

Operating system and version

Windows 11

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

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