[All Adaptavist Apps]

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

{menu} Macro

The {menu}, {submenu}, {sub-submenu} and {menuitem} macros are all the same macro! The different names are merely to aid legibility of menu definitions by allowing semantically/heirarchically correct structures to be built in the following form:

...

This macro requires Theme Builder 2.0 or above.

To recreate the hierarchical structure shown above, use the following notation:

Code Block

{menu}Menu
 {submenu}Submenu
   {sub-submenu}Sub-Submenu
     {menuitem}Menuitem{menuitem}
   {sub-submenu}
 {submenu}
{menu}

...

Property

Required

Default

Notes

class

(error)

 

The CSS class name to assign to an item in a menu

subclass

(error)

 

The CSS class name to assign to a pop-up menu that's associated with an item in a menu

id

(error)

 

The HTML ID (must be unique for the entire web page) associated with an item in the menu

subid

(error)

 

The HTML ID (must be unique for entire web page) associated to a pop-up menu that's associated with an item in a menu

autohide

(error)

true

The following values are permitted:

  • true – the item will be removed if it doesn't contain a hyperlink
  • false – the item will always be shown regardless of whether it contains a hyperlink or not
  • disabled – the item will always be shown, but if it doesn't contain a hyperlink it will be "visually" disabled (e.g. grey text and faded icon)

custom

(error)

false

The following values are permitted:

  • false – a normal menu item, which may contain a pop-up menu if there are hierarchically lower items found
  • true – allows you to embed just about anything in a menu item, defaults the "autohide" setting to false and prevents you from having a pop-up menu associated with the item

flat

(error)

false

The following values are permitted:

  • false – a normal menu item designed for use in a hierarchical structure
  • true – a "flat" (non-hierarchical) menu item

hideanon

(error)

false

Hide the contents of the menu from anonymous users

 

flag

(error)

 

The macro is rendered only if one or more of the specified flags are set. See Working with Flags for more details.

3.3.6

notflag

(error)

 

The macro is rendered only if none of the specified flags are set. See Working with Flags for more details.

3.3.6

unmigrated-wiki-markup

 

The

most

basic

use

of

these

macros

is

to

output

a

single

menu

item:

{
Code Block
}
 {menuitem}[Home Page|Home|Go to the Home Page]{menuitem}
{code}

Which results in:

{menuitem}[Home Page|Home|Go to the Home Page]{menuitem}

We've

used

a

wiki

notation

link

in

the

example

above

to

create

a

link

to

the

Home

page

within

the

current

space.

You

can

use

any

valid

wiki

notation

link

inside

a

menu

item

so

you

could,

for

example,

link

to

a

news

item,

different

space

or

even

a

user

profile.

It

should

be

noted

that

if

you

link

to

a

page

in

a

menu

item,

and

then

rename

that

page,

the

menu

item

will

not

update

itself

to

use

the

new

name

of

the

page.

You

can

get

round

this

problem

by

using

the

[

wikimenu

macro

]

which

allows

you

to

create

a

normal

bullet

list

of

links

on

a

page

(which

_

will

_

be

updated

if

you

rename

pages)

and

then

import

them

in

to

your

menu.

For

all

common

locations

within

Confluence,

we

recommend

using

the

[

menulink

macro

]

as

it

will

be

more

reliable,

especially

if

any

of

the

common

locations

are

changed

in

a

later

version

of

Confluence.

For

example,

to

create

an

ultra-reliable

link

to

a

home

page,

use:

{
Code Block
}
 {menuitem}{menulink:home|tooltip=Go to the Home Page}Home Page{menulink}{menuitem}
{code}

This

might

seem

like

overkill,

but

it

really

is

far,

far

more

reliable

to

link

to

common

Confluence

locations

this

way.

Anyway...

You

can

have

several

items

at

the

same

level,

for

example:

{
Code Block
}
 {menuitem}{menulink:home}Home Page{menulink}{menuitem}
 {menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
{code}

Which 

As you can see, the items are merely output as an unordered list. To put them in to an actual menu bar, simply wrap them in the menubar macro

Footnote

Remember to specify a unique ID for the menubar macro, otherwise it won't work!

as shown below:

Code Block
gives:

{menuitem}{menulink:home}Home Page{menulink}{menuitem}
{menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}

As you can see, the items are merely output as an unordered list. To put them in to an actual menu bar, simply wrap them in the [menubar macro]{footnote}Remember to specify a unique ID for the menubar macro, otherwise it won't work!{footnote} as shown below:

{code}
{menubar:id=demo1}
 {menuitem}{menulink:home}Home Page{menulink}{menuitem}
 {menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
{menubar}
{code}

{display-footnotes}

Which results in:

{menubar:id=demo1}
 {menuitem}{menulink:home}Home Page{menulink}{menuitem}
 {menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
{menubar}

As you can see, the items are shown next to each other because they are at the same hierarchical level. To create pop-up sub menus, you need to create a hierarchical 
Footnotes Display

As you can see, the items are shown next to each other because they are at the same hierarchical level. To create pop-up sub menus, you need to create a hierarchical structure...

 

unmigrated-wiki-markup

 

To

create

hierarchical

structures,

you

wrap

menu

items

in

the

other

macros

as

shown

earlier,

for

example:

{
Code Block
}
{menuitem}{menulink:home}Home Page{menulink}{menuitem}
{menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
{menu}Level 1
 {menuitem}{menulink:home}Home Page{menulink}{menuitem}
 {menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
 {submenu}Level 2
  {menuitem}{menulink:home}Home Page{menulink}{menuitem}
  {menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
  {sub-submenu}Level 3
   {menuitem}{menulink:home}Home Page{menulink}{menuitem}
   {menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
  {sub-submenu}
 {submenu}
{menu}
{code}

Which results in:

{menuitem}{menulink:home

Here's another quick example to show that you can "indent" the menu structure at any point, not just the last item in a level:

Code Block
}Home Page{menulink}{menuitem}
{menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
{menu}Level 1
 {menuitem}{menulink:home}Home Page{menulink}{menuitem}
 {menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
 {submenu}Level 2
  {menuitem}{menulink:home}Home Page{menulink}{menuitem}
  {menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
  {sub-submenu}Level 3
   {menuitem}{menulink:home}Home Page{menulink}{menuitem}
   {menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
  {sub-submenu}
 {submenu}
{menu}

When used within the [menubar macro], the structure above looks like this:

{menubar:id=demo2}
{menuitem}{menulink:home}Home Page{menulink}{menuitem}
{menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
{menu}Level 1
 {menuitem}{menulink:home}Home Page{menulink}{menuitem}
 {menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
 {submenu}Level 2
  {menuitem}{menulink:home}Home Page{menulink}{menuitem}
  {menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
  {sub-submenu}Level 3
   {menuitem}{menulink:home}Home Page{menulink}{menuitem}
   {menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
  {sub-submenu}
 {submenu}
{menu}
{menubar}

Here's another quick example to show that you can "indent" the menu structure at any point, not just the last item in a level:

{code}
{menuitem}{menulink:home}Home Page{menulink}{menuitem}
{menu}Level 1
 {menuitem}{menulink:home}Home Page{menulink}{menuitem}
{menu}
{menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
{code}

Which gives:

{menubar:id=demo3}
{menuitem}{menulink:home}Home Page{menulink}{menuitem}
{menu}Level 1
 {menuitem}{menulink:home}Home Page{menulink}{menuitem}
{menu}
{menuitem}{menulink:dashboard}Dashboard{menulink}{menuitem}
{menubar}

To follow.

None at present.

 

See Customising Menu StylesNone at present.