Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The function examples on this page require sample content. Look at each example to figure out what kind of content it needs.

Example: children Children  is a function that retrieves the children of the current node. To get meaningful results you need to execute the code on a page that has some children.

...

Returns a map of localized links to the current node. This means: If you have defined three locales en, de_DE and de_CH the function returns localized links to the node of the context on which you are applying the function. (If the current content node is a component, the function searches the parent page node.) (warning)  Magnolia 5.4.1+

Example: The map could look like this:

...

String dump(Object obj, int depth, boolean asHtml)

Arguments

obj

required

Specifies the object type to be inspected. The following objects are available in the default implementation of this inspector function:

  • null values
  • Scalars
  • Dates
  • Calendar
  • Arrays
  • Collections
  • Maps
  • ContentMaps
  • Nodes
  • Properties
  • Objects (this one describes only the object class to avoid generating huge hierarchies)


depth

optional, default is 3

Specifies the depth of the inspection.

asHtml

optional, default is false

Output into a simple HTML format.

Returns

String

Usage

cmsfn.dump(obj, depth, asHtml)

...

Checks whether the content is requested in the page editor in edit mode on author instance.

Method signature

boolean isEditMode()

...

Checks whether the content is requested in the page editor in preview mode. The check can be run either on the author instance or on the public instance.

Method signature

boolean isPreviewMode()

...

Code Block
languagexml
[#assign queryStringAndFragment = cmsfn.queryStringAndFragment("http://example.com#myApp::running?q=abcd")]
Query string and fragment: ${queryStringAndFragment}

Language

See also Get localized links above.

Current language

Retrieves the language currently used.

...

Code Block
languagexml
<html xml:lang="${cmsfn.language()}" lang="${cmsfn.language()}" class="no-js">
Info

Please note that ${ctx.locale} is different from ${cmsfn.language()}, the former referring to the locale currently used by the user, the latter to the locale currently used by the site. See also AdminCentral and public locales.

Wrap content in i18n node wrapper

...

 

content

required

The content map whose metadata you want to get.

property

required

Metadata property:

 


CREATED"mgnl:created"
CREATED_BY"mgnl:createdBy"
LAST_MODIFIED"mgnl:lastModified"
LAST_MODIFIED_BY"mgnl:lastModifiedBy"
TEMPLATE"mgnl:template"
LAST_ACTIVATED"mgnl:lastActivated"
LAST_ACTIVATED_BY"mgnl:lastActivatedBy"
ACTIVATION_STATUS"mgnl:activationStatus"
DELETED"mgnl:deleted"
DELETED_BY"mgnl:deletedBy"
COMMENT"mgnl:comment"

...