Important

Major updates are in progress. Some pages and languages may not be available.

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.

Plugin help
The plugin's help text.
Creating plugin help
function wikiplugin_pullquote_help() {
	return tra("Create a literary pullquote").":<br /> §daa7f729d6da8ce5ede30ee87df4a16d§ ";
	}


Now we'll add detailed help information for the Tiki inline plugin help (when users add the plugin through the Tiki help interface.

Plugin help
The detailed help explains the valid values for each option.
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 Tiki .{NOTE}

Advertising