Gold/Docs/Anatomy of a Search Plugin
From Mahara Wiki
< User:Gold | Docs
This is intended to become a developer reference.
How to get your plugin seen by the system
The Plugin will live in the
htdocs/search directory and needs to extend the
PluginSearch class. As with all Mahara plugins the class is loaded from/lives in the
lib.php file in the plugin directory.
htdocs/search/Mysearch ├── lib │ └── PluginSearchMysearch.php ├── lib.php └── version.php
To keep things tidy we are adding a
lib directory where the class files will live. This isn't strictly needed, but if your plugin is going to create multiple classes this is a way to keep the line count per file down to a manageable level. If you are only going to need one class though, skip this and just add it to the
The following methods need to be implemented by your Plugin.
get_plugin_display_name()to give your plugin a human readable name.
Adding a configuration form is just a matter of implementing the following methods.
has_config(): Tells the system there is a config form. Shows the config cog on the Plugin Administration screen.
get_config_options(): Return a Pieform array.
validate_config_options(Pieform $form, $values): Validate the user input from your config form.
save_config_options(Pieform $form, $values): Save config options and react to any values entered.