Shortcodes

Maintained by Frédéric Massart ⭐
Allows users to inject and modify content using shortcodes provided by other plugins.
Price option: Free

Supports Moodle 3.1-5.1 See all versions
Latest release: 9 months ago
Installations: 2936
Downloads (last 90 days): 520

Frankenstyle name: filter_shortcodes
Filters

Description

This plugins allows users to use shortcodes in content throughout Moodle to inject or modify content with ease. The shortcodes are provided by other Moodle plugins.

Usage

A shortcode is constituted of a word between square brackets. There are two types of shortcodes: the ones that wrap content, and the ones that do not. Those that do wrap content MUST have a closing tag. Here is an example using [useremail] which prints the current user's email, and [toupper] which wraps content and makes it uppercase.

Your registered email address is: [useremail].

[toupper]This text will be uppercased[/toupper].

You can also nest the shortcodes, let's make the user's email address uppercase.

Your registered email address is: [toupper][useremail][/toupper].

Some shortcodes support arguments. Those are declared in the same manner as HTML attributes. Here is an example of a shortcode that would add a collapsible section with a height of 100, and which would be collapsed by default:

[section height="100" collapsed]

Attribute values do not require to be wrapped between double quotes, but it is recommended. When the attribute does not have a value, it is considered to be true. Single quotes cannot be used in lieu of double quotes.

List of shortcodes

Once the plugin is installed, the list of all available shortcodes and documentation on how to use them will be available at the URL: http://your-moodle-site/filter/shortcodes/index.php. By default this page is available to all logged in users, though this can be changed using the permission filter/shortcodes:viewlist.

Plugins supporting shortcodes

Your plugin supports shortcodes? Let us know!

For developers

Developers can easily add support shortcodes in their plugin. See the documentation for more information.



Provided by
Branch Up

Contributors

Awards

Early bird 3.5
Automated testing support
Privacy friendly
Early bird 3.6
Early bird 3.7
Early bird 3.10
Early bird 3.11
Early bird 4.0
Early bird 4.1
Early bird 4.2
Early bird 4.4
Early bird 4.5
Early bird 5.0
Early bird 5.1