Now, updating for Tiki 9! Get Smart...
Now accepting new user registrations! Become a contributor.
Adding Security and Help
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 /> ~np~{PULLQUOTE(width=###|color=######, float=left|right)}".tra("text")."{PULLQUOTE}~/np~ ";
}
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.'),
'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(
'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 |
Contributors to this page: Rick Sapir
.
Page last modified on Wednesday, November 10, 2010 08:21:42am EST by Rick Sapir.
The content on this page is licensed under the terms of the Copyright Information.
Sidebar
What do you think?
What do you think of this project?
"..very good as a starter..."
Is Essentials helpful?


