[All Adaptavist Apps]

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: loads of fixes and added the @parent feature

...

Property

Required

Default

Notes

Theme Panels Only

decorator

(error)

all decorators

Only hide the content when a specific decorator us being used, eg. "printable", etc.

(tick)

context

(error)

all contexts

Only hide the content for specific context(s), eg. "page", "global", etc.

(tick)

mode

(error)

all modes

Only hide the content for specific modes, eg. "view", "edit", etc.

(tick)

space

(error)

n/a

Only hide the content if a specific space (referred to by the Space Key) exists.

 

page

(error)

n/a

Only hide the content if a specific page (referred to by the page title) exists.

 

title

(error)

n/a

Only hide the content if the current page has a specific title

 

label

(error)

n/a

Only hide the content if the the current location (page, news, etc) has the specified label(s), eg. "my:favourite", "meetings", etc.

 

metadata

(error)

n/a

Metadata associated with the current location in the frormat: "myKey1:myValue1", etc.

 

...

Mode

Notes

Menulink

rss

RSS Feed Builder

RSS

more to follow (smile)

Examples

...

Hide content on news items

To display hide some content only on news items (blogposts), you must use the macro within a panel in the Builder theme:

Code Block
{builder-hide:context=news}
{menulink:news}Back to News Summary{menulink}This text will not be shown on news items
{builder-hide}

...

Hide content on pages and news items

To hide something in multiple contexts, simply separate them with commas:

Code Block
{builder-hide:context=page,blogpost}
something to hide on pages and news items
{builder-hide}

...

Hide content in edit mode

When you change the view of something, eg. look at the normal view or editable view, the "mode" changes and you can take advantage of this to customise your theme depending on which mode is currently active. For example, if you only want to hide something when it's being edited (eg. editing a page or news item), use the following:

Code Block
{builder-hide:mode=edit}
something to hide
{builder-hide}

You can hide something in multiple modes by separating them with commas:

Code Block
{builder-hide:mode=edit,view}
something to hide
{builder-hide}

...

If you only want to hide something in view mode within the context of a page, use the following:

Code Block
{builder-hide:mode=view|context=page}
something to hide
{builder-hide}

When more than one parameter of the macro is specified, both parameters must match so in the example above the user must be looking at a page context in view mode.

You can specify multiple modes and contexts, for example:

Code Block
{builder-hide:mode=view,edit|context=page,blogpost}
something to hide
{builder-hide}

In the example above, the content would be hiden if the user is looking at either a "page" or a "blogpost" (news item) that must also be in either the "view" or "edit" mode.

...

Hide content based on labels

You can display hide content if the current location has one or more of the specified labels:

Code Block
{builder-hide:labels=my:favourite,meetings}
Thisdon't stuffshow isthis eitheron incontent mylabelled favouritesas listthe orusers' somethingfavourite toor do with meetings!
{builder-hide}

Beware! Most people assume that only pages and news articles can have labels, but this is not the case. When viewing space-level pages that aren't normal content pages or news articles, for example when viewing the space labels or even space admin, this macro uses any defined space labels and even team labels.

...

Hiding content if a space exists

You can hide content only if a space exists by specifying it's space key as follows:

Code Block
{builder-hide:space=ACCOUNTS}
Here's some info about the accountsThe space, butwith you'll only see this
if you have privileges to access the accounts space.key "ACCOUNTS" does not exist!
{builder-hide}

As you can see, this is ideal for customising content based on which spaces a user has privilegs to access.

...

If the user doesn't have access to a space, it's as if the space doesn't exist.

Hide content based on existence of a page

You can display hide content only if a specific page (within the current space) exists:

Code Block
{builder-hide:page=My Page}
{include:The page "My Page}" does not exist!
{builder-hide}

In the example hiden above, we only include the page if it exists. This hides the nasty error message that the include macro generates if that page does not exist. While it might seem a little strange to only hide things if a specific page exists (especially considering you know the title of that page), it's extremely useful in scenarios where you are using templates and only want to hide content or links if a specific page exists within the current space.

...

This is really useful because you can show warnings or links, etc., if pages don't exist. For example, you might want a legal disclaimer in a space and you could warn users if it doesn't exist.

Hide content if the page has a parent

You can hide content if the current page has a parent page using the following notation:

Code Block

{builder-hide:page=@parent}
This page does not have a parent page!
{builder-show}

This is useful because you often want to include specific navigation on pages that do not have a parent page, for example you might want to include the pagetree macro on your home page to ease navigation.

Pages which don't have a parent are:

  • The space homepage
  • Orphan pages (pages within a space that don't have a parent)

Hide content for specific page titles

You can display hide content if the current page has a specific title, for example:

Code Block
{builder-hide:title=My Homepage}
HiThis all, this must beis not my home page because it's title is "My Homepage"!
{builder-hide}

This can come in handy if you are using templates to generate content and want to hide something based on the page title.Another use is if

users are constantly using a page title that causes problems, for exmaple they might call a page "Meetings" and you want them to call it "yyyy/mm/dd - Meeting with x, y, z") - as such you could add this to the Title panel within theme configurationAlternatively, you might want a specific page title to be used whenever a certain template is used, for example:

Code Block
{builder-hide:title=Meeting}
You muppet(!) UsePlease arename morethis descriptive page titleto that includes
the date (and time if appropriate), type of meeting and who
was involved, etc"Meeting" to aid consistency throughout this site.
{builder-hide}

OK, you might not want to be that harsh in explaining to users that "Meeting" isn't a great page title and that they should use something more descriptive, but you get the general idea.

Another use is to add labels to pages based on their title:

Code Block
{builder-hide:title=Home}{add-label:not-home-page}{builder-hide}

Simply add that to the Header panel in theme config and any page that is not called "Home" will get a label of "not-home-page" added to it thanks to the add-label macro. This is useful because it allows you to search all home pages pages that aren't a home page within the site!

...

Hiding content based on metadata

(warning) Alain to fill this bit in as I have no idea how it works! Also note the hierarchical nature of the checking on this.

...

You can use this macro, and the associated builder-hide show macro to customise navigation and panel content depending on what the user is looking at.

When using either the mode, context or context decorator parameters, remember that they only work if used within a panel of the Builder theme. If you put them inside a normal page, etc., they won't work. Even if you use the move-to macro to move something from a page in to a panel, it still won't work - the mode, context and decorator settings will only work if the macro is actually in the panel notation in the theme cofiguration settings.

If you need to hide show or hide content based on the privileges within a space, use the hideshow-if or hide-if macros that be found in the Visibility Plugin.

Frequently Asked Questions

None at present.

See Also