BC features that use Liquid

Updated on 20-October-2016 at 10:16 AM

Business Catalyst End of life announcement - find out more details.

Liquid Enabled Modules

One of the first steps to implementing Liquid in BC was to enable modules to receive named parameters. Traditionally, in the BC module syntax the parameters had to be separated by commas.

The parameters not only had to be placed in a specific order, there were also some "slots" that were not used thus complicating the syntax even more.

For example this is how a {module_productfeaturelist} looks when it is inserted using named parameters:

{module_productfeaturelist tag="featured" rowCount="4" sortType="Weight" useBackupLayout="false"}

This module will work exactly as its "comma separated" counterpart:

{module_productfeaturelist,featured,4,weight,}

To control the way a Liquid enabled module will be rendered we can use 3 parameters: template, render and collection.

In the example below, the webapp listing will be rendered using the custom template /layouts/custom/car_collection.tpl, the template content will be treated as a collection and the myWebapp collection will be created so we can access its items using Liquid like we did in our loops example.

{module_webapps collection="myWebapp" render="collection" template="/layouts/custom/car_collection.tpl" id="35209" filter="all"}

Note: If none of the 3 parameters are specified, for example {module_webapps id="35209" filter="all"} the webapp listing will be rendered using the default layout.

template

This is not a new parameter, it was originally introduced to specify the path to a custom template that will be used to render the module. With the introduction of Liquid its scope has been expanded, it is now also used to suppress a module's output.

Take a look at the complete template article for more details and use cases for this parameter.

render

This parameter indicates whether the contents of the layout (this can either be the default list layout or a custom layout) used to render the module should be interpreted as a single item or a collection.

The possible values of the render parameter are item or collection.

Some modules only support one of these methods, some support both. Every module has a detailed page in our reference documentation, you can check them out starting from the Module reference page.

Take a look at the complete render article for more details and use cases for this parameter.

collection

The collection parameter simply creates a Liquid collection that contains all the module's items. You can then access the collection, loop the items and further process them. You can give it any name you please.

Note: The "collection" parameter is totally different from render="collection".

This method is usually used in conjunction with the template="" parameter that suppresses the module's output but sometimes you might want to use it only for additional behavior.

Take a look at the complete collection article for more details and use cases for this parameter.

Liquid Enabled Tags

There are some tags that need to be specifically inserted into layouts to become available as objects in a Liquid collection.

Do not worry, using Liquid you can easily capture the data of those tags and output it to your liking.

Note: For the supported list of tags that can be Liquid enabled, please check out the complete article.

Liquid with module_data

This module is the missing link between front-end and REST API endpoints . It does not belong to any particular section, it can be used to fetch any piece of data which can be accessed by the v3 API endpoints.

Note: Only list-type of operations are supported. Create, modify or delete operations (the equivalent of POST, PUT and DELETE) are not supported.

Simply put, if there is an endpoint created, you can use module_data to fetch that data and then using Liquid logic and filters, you can output it the way you want it for your visitors.

If you need help, please check out how to consume API's in the front-end using module_data article or the {module_data} reference page.

Liquid with module_json

This module is used to render a custom JSON file using a custom template file you create, pretty much like how most classic BC modules work.

After applying the module, Liquid comes to your help yet again and gives you the tools to parse that JSON objects and output them.

If you need help, please check out how to render your own JSON files using module_json article or the {module_json} reference page.

Additional Liquid Features

Render a page in JSON format

Another interesting feature introduced with Liquid is the ability to render a page in JSON format . All the elements of that page including module output and collections will be made available in a JSON object.

Pass custom parameters to modules

You can now pass custom parameters to Liquid enabled modules, this means that you can basically extend the list of tags that are available on a module's layout and share data between modules.