Container Macro

Last modified by Admin on 2024/03/25 15:44

cogArrange and decorate its contents according to the parameters
TypeJAR
Category
Developed by

XWiki Development Team

Active Installs10
Rating
1 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Compatibility

XWiki Platform >= 2.5M2

Installable with the Extension Manager

Description

For now, the only implemented decoration is the layout, and in particular the columns layout.

Usage

Use the container macro to define the layout and put the content to be layouted inside the container macro. For example, to layout content in columns, add a wiki group for each column inside the container macro, as in this example (for 2 columns).

{{container layoutStyle="columns"}}
(((first column)))
(((second column)))
{{/container}}

Note that inside the column groups you can add any wiki content. For example, the following result can be achieved (a 2 columns layout, with wiki content in the columns):

columns.png

Since XWiki 6.0, this macro is now responsive, which means that if there is not enough place to display the columns side by side, there are instead displayed one after the other in a vertical way. It improves the user experience.

responsive.png

Parameter definition

NameOptionalAllowed valuesDefault valueDescription
layoutStyleyesany string, only 'columns' is implemented by default, for time beingnoneThe layout to use for the content grouped by the container macro. If missing or a non-implemented value is passed, no layout is applied, the content of the container macro is just rendered as if the macro was not there.
justifyyesboolean (true/false)falseWhether the content in the container is justified or not (for the columns layout, it specify if the columns are be justified or not).

For developers

You can easily implement your own layout style to be used with the container macro, by implementing the LayoutManager interface as a component, and dropping your implementation in the classpath (WEB-INF/lib of your wiki installation). The hint of your component will be the name of the layout style to pass to the container macro.
For example:

@Component("grid")
public class GridLayoutManager implements LayoutManager
{
 ...
}

which can then be used in a wiki page by writing:

{{container layoutManager="grid"}}
your defined wiki content for the grid layout goes here
{{/container}}

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.

Dependencies

Dependencies for this extension (org.xwiki.platform:xwiki-platform-rendering-macro-container 16.2.0):

    

Get Connected