This module is available starting from release/2020.021
.
The categories module can be used to display some subset of categories in various places in your theme with a few different visual layouts.
Configuration Options
This module has a few different configuration options available.
apiParams
A set of parameters passed the endpoint. All parameters supported there are supported by the widget.
See the documentation for all supported parameters.
The defaults as are follows:
{
"featured": true,
"limit": 10,
// If subcommunities is enabled, the root category of the subcommunity will be used.
"parentCategoryID": -1,
}
Want to use some specific categories?
Try the categoryID
filter and pass some specific category IDs.
{
"featured": false,
"categoryID": [1, 53, 169]
}
title
A title to display above the module. Empty by default.
subtitle
A subtitle to display above {subtitle: {content:"This is my subtitle", type: "overline"}}
or below {subtitle: {content:"This is my subtitle", type: "standard"}}
the title. Padding and font options also can be passed to the module. Empty by default.
description
A description for the module.
headerAlignment
Default for this is "left"
, but id "center"
passed, title, subtitle and description will be aligned to center.
maxColumnCount
The maximum number of columns to display for the results.
contentType
The display type to use for the widget. See content types documented below. Defaults to the one chosen in the theme ( {contentType: "title-description-icon"} )
by default).
Different contentTypes
The widget supports 4 content types. These can be specified when declaring the widget, or configured by the theme. The theme editor offers extensive configuration of this widget at the theme level.
title-description
A text only variant.
title-description-icon
Use text and the category icons. This contentType has another option to place icon on the left {iconProps: {placement: left}} ,
icon background
or border
are also configurable through iconProps
.
title-description-image
Use text and the banner image from the category.
title-background
Overlay the title of the category on top of the banner image.
Default Placement
A featured categories module appears by default in the foundation theme when there are featured categories available.
Placement with Twig
In a twig master view the module can used as follows:
{% if isHomepage %}
{{ renderModule("Vanilla\\Community\\CategoriesModule", {
title: t('Featured categories'),
apiParams: {
featured: true,
limit: 10
}
}) }}
{% endif %}
Placement with Smarty
{if $isHomepage}
{$apiParams = ['featured' => true, 'limit' => 5]} }
{module name="Vanilla\\Community\\CategoriesModule" title="Featured Categories" apiParams=$apiParams }
{/if}