Filtering access and visibility of a Qtag

Sometimes you want a Qtag to display only under certain conditions.

In the usual CMS, you would have to write some special PHP code for this. 

Quanta tries to make your life easier, allowing you to filter a Qtag's visibility by adding filtering rules directly within the Qtag itself.

Let's make some examples of filters applied to Qtags.

Filtering Access to a Qtag 

[LINK:home]

This Qtag shows a simple link to the homepage.

Filtering by role

[LINK|filter=user_role@admin:home]

... shows the Qtag only if the current user has the "admin" role.

Filtering by user name

[LINK|filter=user_name@administrator:home]

... Shows the Qtag only if the current user is "administrator".

Filtering by path of current node.

[LINK|filter=path@somenode:home]

... Shows the Qtag only if the currently viewed node is "somenode".

Filtering by father of current node.

[LINK|filter=father@somenode:home]

... Shows the Qtag only if the father of the currently viewed node is "somenode".

Filtering by lineage of current node.

[LINK|filter=lineage@somenode:home]

... Shows the Qtag only if the currently viewed node has "somenode" in its lineage (so as its father, father or the father, etc.).

Filtering by http referer

[LINK|filter=referer@somenode:home]

... Shows the Qtag only if the node you are coming from (in the browser) is "somenode" 

Filtering by context

[LINK|filter=context@node_add:home]

... Shows the Qtag only if the current context is "node_add". (In this specific example, show the Qtag when the current user is adding a new node using Shadow). 

[LINK|filter=context@node_add:home]

...in this example, we show the tag only if we are in a "node add" page. 

Grouping filters

Multiple filters can be applied to the same Qtag, separated by the , (comma) character.

[LINK|filter=user_role@admin,path@somenode:home]

This example will only show the link if the current user has the "admin" role, and the currently viewed node is "somenode".

Multiple filter values

A filter can be applied to multiple values, separated by the ; character. The operator will always be an OR (at least for now). 

[LINK|filter=user_role@admin;editor:home]

This example will only show the link if the current user has the "admin" role, OR the "editor" role.

Negation

A filter's result can be reversed by adding a negation sign

[LINK|filter=user_role@!editor:home]

The above example will only show the link if the current user does NOT own the "editor" role.

Nesting qtags in filters 

You can - of course - use nested qtags in your filters.

[LINK|filter=path@{USER_ATTRIBUTE|name=name}:home]

The above example will only show the link if the user is seeing his own page (the path of the current node is the same as his name)