Loading...
 
Skip to main content

History: Plugin Alias

Source of version: 38 (current)

Copy to clipboard
            __Plugin Alias__ is a new feature since ((Tiki3)) to make "new plugins" (aliases) based on previously existing plugins in your Tiki site. 

''Were you looking for Wiki page ((alias links)) instead? ''

!! Key features
* Permits the creation of the "new plugins" directly from the control panel, without FTP access
* These new plugin aliases use an existing plugin as a base
* These new plugin aliases 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
The Plugin Alias management can be found on the admin control panel, "Editing and Plugins" under the "Plugin Aliases" tab (-+tiki-admin.php?page=textarea&cookietab=3+-).

!! Limitations
Plugin name can't contain special characters like a hyphen (-).

!! Examples

!!!Simple example
Plugin aliases permit you to go from this:
{CODE(wrap=1)}
{TRACKERLIST(trackerId=>11,fields=>194:220:196,max=>-1,filterfield=>220,filtervalue=>Quebec,showlinks=>y)}{TRACKERLIST}
{CODE}

To this:
{CODE()}
{pavillon filtervalue=Quebec}
{CODE}

Here is how to configure the alias:
^{img src="img/wiki_up/Plugin_Alias_example_Pavillon.gif" width="500px" align="center"}^

!!!Variable body
Problem~hs~: The syntax of a plugin alias is different from a standard wiki-plugin.
For instance, here is the syntax for a ((PluginBox)), with a width of 100% and "hello" in the body~hs~:
{CODE()}{BOX(width=100%)}hello{BOX}{CODE}
You can create a plugin alias based on a box with a predefined width of 100% and a pre-defined content that will in the wiki look like~hs~:
{CODE()}{my_plugin}{CODE}
There is no way here to let an user change the body.

To do that, here is a configuration example. In this example the body will be pre-filled with the word "hello" and an user will be able to complete it with anything~hs~:
*plugin name~hs~: "my_plugin"
*base plugin~hs~: "box"
*simple plugin arguments
**width, default~hs~: "100%"
**my_var, default~hs~: ''(empty)''
*plugin parameter documentation
**my_var, name~hs~: "my_var"
*plugin body
**default content~hs~: "hello ~np~%my_var%~/np~"
**parameters~hs~: "my_var", default~hs~: "world"
Now, the following code~hs~:
{CODE()}{my_plugin}{CODE}
will look like
{BOX(width=100%)}hello world{BOX}
And the following code~hs~:
{CODE()}{my_plugin my_var="john"}{CODE}
will look like
{BOX(width=100%)}hello john{BOX}


!! 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 after you already created it, remove its name and value and save changes using "Change Preferences" button in order to have it deleted.
 
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:
{img fileId="1303,1304,1305" thumb="box" responsive="n"}

!!Related links
* http://dev.tiki.org/Plugin+Alias
* [http://profiles.tiki.org/Plugin+Alias+Handler|Plugin Alias Handler for Profiles]
* For an alternate explanation, you can read [http://dev.tiki.org/item2156]


-=Alias=-
* (alias(PluginAlias))
* (alias(Plugin Configuration Tool))