Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

Conditional field not working

Started by Romarain 7 years ago · 1 replies · 479 views
7 years ago

Hi,

I would like to condition the display of a field (a list of modular templates) only if the page edited in the admin is a modular page. So I use :

YAML
        template_condition:
          type: conditional
          condition: "page.modular ? 'true' : 'false'"
          fields:

but it doesn't work.
At the opposite :

TXT
          condition: "page.modular != true"

works, and that's not normal, given that the page is a modular one...

Tests on the page's title also fail :

condition: "page.title == 'Recrutement'"
condition: "page.title == 'Recrutement' ? true : false"
condition: "page.title == 'Recrutement' ? 'true' : 'false'"

last edited 10/27/19 by Romarain
7 years ago

As

TXT
condition: "page.header.visible is same as(null) ? 'true' : 'false'"

seems to show the field, I deduce that the variables aren't set. There's a problem with the access to page's header in my blueprints.

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 54 11 hours ago
Support · by Anna, 3 days ago
2 60 14 hours ago
Support · by Justin Young, 15 hours ago
1 30 15 hours ago
Support · by Duc , 1 week ago
2 65 5 days ago
Support · by Colin Hume, 1 week ago
2 57 5 days ago