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 PHP code for this.

In Quanta, you could do that as well, using a custom hook, or in the specific qtag code. But the easiest, generic way, is just adding your filtering rules... directly in the qtag itself!

Let's make some examples of filtering qtags.

[LINK:home]

This shows a link to the homepage.

Filtering qtag by role

[LINK|filter=role@admin:home]

... show only if the current user has the "admin" role.

Filtering qtag by user name

[LINK|filter=user@administrator:home]

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

Filtering qtag by path of current node.

[LINK|filter=path@somenode:home]

... show only if the currently viewed node is "somenode".

Filtering qtag by father of current node.

[LINK|filter=father@somenode:home]

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

Filtering qtag by lineage of current node.

[LINK|filter=lineage@somenode:home]

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

Filtering qtag by http referer

[LINK|filter=referer@somenode:home]

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

Filtering qtag by context

[LINK|filter=context@someaction:home]

... show only if the current context is "someaction". (Context is the action being ran, normally when opening a Shadow overlay). 

[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, separated by the , (comma) character.

[LINK|filter=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=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=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@guest: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)