Example Module 2: a multilingual "Hello World" plugin

This example shows a more advanced version of the "Hello World" plugin.

It demonstrates how to write the init() method to change how a plugin is displayed, how to write a Twig framework, and how to make a Twig framework multilingual.

The description.yaml file

There are two new properties here:

Setting the vlp_class_name property allows your module to use phrases.

The default_framework property lets you set the default framework for your plugin.

The init() method

This is called by the CMS before the page is generated. You can use it to handle POST requests, or set flags about your plugin's behaviour.

In this case a flag is set that will allow the plugin's output to be cached, if page or plugin caching is enabled.


Your module can have one or multiple frameworks. To create a framework, you need to create a frameworks directory inside your module, create one or more subdirectories, and then put a file called framework.twig.html in each subdirectory.

If your module has more than one framework subdirectory, the CMS will allow an administrator to choose one when they use a plugin created by your module.