Example Module 3: a plugin to show plugin settings and phrases

This example shows more advanced usage of phrases, demonstrates how to create a plugin setting, and how to give your module a revision number.

Defining Plugin Settings

The CMS will automatically create a plugin settings Admin Box for you, which will let an administrator change the framework your plugins use.

If you wish to have more settings for your plugins, you can target this Admin Box and add more fields by writing a file called tuix/admin_boxes/plugin_settings.yaml.

The fields you define in the plugin_settings.yaml file are merged into the Admin Box that the CMS has written, meaning that the administrator will see both sets of fields. More information on how this works will be provided in the Interface section.

Automatically inserting phrases into the database

You can automatically insert phrases into the database upon installation of your module by creating a CSV file with phrases in.

These files need to be put in the phrases/ directory of your module, and need to be named after the code of the language that they are for, e.g. "en.csv" or "fr.csv".

Setting a revision number for your module

You can set a revision number for your module by creating a latest_revision_no.inc.php file in your module's directory. (Note that if you do not create a latest_revision_no.inc.php file, your revision number will default to 1.)

Every time your increase your revision number, the CMS will reread and update:

  • the meta-information in your description.yaml file
  • the default values of your plugin settings
  • any phrases that you defined in a CSV file

the next time an administrator logs in to your site.