You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

Hide and show conditions

Every node in the Page Tree can have show conditions which determine its visibility for the current user.

fig

Visibility Controlled By Locale

The visibility can be controlled by the locale (“Show for Locales” and “Hide for Locales” in the screenshot). Multiple locales can be entered as a comme-separated list.

Examples:

  • Show for Locales: en_US
    • This would show the node for the locale en_US
  • Hide for Locales: de_DE, de_AT, de_CH
    • This would hide the node for the locales de_DE, de_AT, de_CH

Visibility controlled by functions

Nodes can be shown and hidden by using “Show conditions” and “Hide conditions”. All built-in functions can be used to determine the visibility of the node though the main function should be a Boolean function.

Note: Even though we are using template expressions we do not use ${} because the complete expression is interpreted as a template expression.

Examples:

  • Show condition = and(not(empty(me)), equal(me.name, 'admin')
    • This code ensures that the node is only shown for logged in users whose name is admin
  • Hide condition = gt(12, 5)
    • Hides the node if 12 is greater than 5 which is always true and so the node is always hidden

Search results for "Hide and show conditions"

We could not find anything matching "Hide and show conditions" in our documentation. Please rephrase your search.

You can also ask your questions in the Structr Google Group or create a free account in the Structr Support Portal.
Click here to send feedback to the Structr team.