Plugin Alias is a feature that allows turning complex Tiki syntax into a simple, understandable and self-explanatory one by replacing an existing plugin with one that extends or modifies its behaviour to make the latter reusable across many wiki pages or many stages of the same wiki page.
Were you looking for Wiki page alias links instead?
Key features
- Permits the creation of new plugins directly from the control panel without touching the code source
- These new plugins are based on native Tiki plugins
- These new plugins can have any name
- They have some internal documentation (which appears in Plugin Help)
- Can be distributed via Profiles (see https://profiles.tiki.org)
Benefits
- Permits to create very specialized plugins without duplicating code
- It permits to specify from a single location, arguments that are passed to these plugins
- for confidentiality
- for simplicity
- central management/reduce potential errors
- If a plugin alias is used in hundreds of wiki pages, and you want to change a setting, you change it in one place
How to use
To manage plugin aliases, open the admin control panel, then:
- Under Global Setup, open Editing and Plugins
- Then activate the Plugin Aliases tab
- That tab will contain available aliases and a creation form; see picture below:
Limitations
- Plugin name can't contain special characters like a hyphen (-).
Examples
1. Simple example
Let's consider a TrackerList plugin used to filter out items and display them with the following syntax:
{TRACKERLIST(trackerId=>11,fields=>194:220:196,max=>-1,filterfield=>220,filtervalue=>Quebec,showlinks=>y)}{TRACKERLIST}
Next, we want to have the same plugin on another page.
That's a bunch of coded characters we wouldn't want to copy-paste here and there for the same outcome, right?
Instead, we create a plugin alias based on TrackerList, providing its arguments. And we end up with:
{pavillon filtervalue=Quebec}
Notice how much better it got. Here is how to configure the alias:
2. Variable body
This is a concept to facilitate configuring the base plugin body content as a parameter to the alias plugin. Unlike plugin parameters, which are available at the alias level by default, the body does not share any with the alias at use time. It can only be provided at the alias configuration level, making modification at use impossible.
To overcome that, one needs to configure a dedicated parameter to the alias and reference that in the alias plugin body configuration using a special syntax.
Let's consider the following base plugin:
{BOX()}hello{BOX}
Here is what the alias config would be:
Notice %body% in the "Plugin body Default content" field. That's the magic reference to the body argument.
So, using:
{boxalias}
Will yield:
And changing the body:
{boxalias body="john"}
This happens:
Usage
When using plugin alias to show just some items from PluginTrackerList, the parameter to filter results at the "Plugin Parameter documentation" need to be also added as arguments of your plugin alias, at the section "Simple plugin arguments" with no value (in this example: "filtervalue").
If you need to delete one argument or one parameter already created, hit the delete button at the end of your element and then apply the changes.
To see real life examples of how it is used, you can install one of profiles where it is being used:
https://profiles.tiki.org/tiki-searchindex.php?highlight=plugin_alias
Composed Arguments Example
This plugin makes a COL plugin alias (based on PluginDiv) to create a Bootstrap grid column:
Related links
- http://dev.tiki.org/Plugin+Alias
- Plugin Alias Handler for Profiles
- For an alternate explanation, you can read http://dev.tiki.org/item2156