Skip to content

Using grid field after AND/OR conditional to check for true fails. #5480

Open

Description

@robinsowell

{if add_on_images OR add_on_video}

Both of those are grid fields- I'm just trying to check for whether anything exists in either to display the content. But the second grid always returns false.

A bare Grid name in a conditional only works when ExpressionEngine rewrites it to a row count. That rewrite only happens for the field sitting directly against {if:

add_on_images is the field ExpressionEngine counts. It has no rows, so that side is false.
add_on_video is not rewritten. ExpressionEngine uses the channel data column instead of the Grid table. Grid only stores a search blob there, and this video row is not in it, so that side is false too.

Swapping in :total_rows on the same OR does not fix it. The modifier regex has the same limitation: only the field right after {if is calculated, so OR add_on_video:total_rows is still false.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions