What good is creating the perfect Tiki plugin if no one knows how to use it? It is important to always include proper documentation and end-user help for your plugins.
First, we'll add help text that appears when users list the available Tiki plugins.
Creating plugin help
function wikiplugin_pullquote_help() {
return tra("Create a literary pullquote").":<br /> §7b0df23f478313be129f26d4ecf04ef5§ ";
}
Now we'll add detailed help information for the Tiki inline plugin help (when users add the plugin through the Tiki help interface.
Plugin information and security
function wikiplugin_pullquote_info() {
return array(
'name' => tra('PULLQUOTE'),
'description' => tra('Create a literary pullquote in a wiki page.'),
__~~#0C0:'validate' => 'all',~~__
'params' => array(
'color' => array(
'required' => false,
'name' => tra(Color of the pullquote'),
'description' => tra('Numeric hex color code (default=000000). Do *NOT* include #.'),
'filter' => 'int',
),
'width' => array(
'required' => false,
'name' => tra('Width of the pullquote'),
'description' => tra('Numeric width in pixels (default=250). Do *NOT* include px.'),
'filter' => 'int',
),
'float' => array(
__~~#0C0:'required' => true,~~__
'name' => tra('Specify location of the pull quote.'),
'description' => tra('left | right (default=left)'),
'filter' => 'alpha',
),
),
);
}
Notice the lines highlighted in the sample code, above.
- 'validate' => 'all': This tells Tiki that a trusted site editor (with the necessary permissions) must validate (that is, approve) the plugin before it becomes active on the page.
- 'required' => true: The float parameter is required; users must select a position (left or right). Tiki will not allow users to add the plugin to a wiki page without entering this parameter.
{NOTE()}Learn more about all the possible plugin variables on the Tiki Developer website
.{NOTE}