local NOBUG Added another settings example (probably typical usage) to the excellent documentation about local plugins

This commit is contained in:
Sam Marshall 2010-12-01 17:48:58 +00:00
parent bea9531a78
commit 2528fe1408

View File

@ -56,16 +56,17 @@ Local plugins are used in cases when no standard plugin fits, examples are:
* custom admin settings
Standard plugin features:
* /local/xxx/db/version.php - version of script (must be incremented after changes)
* /local/xxx/db/install.xml - executed during install (new version.php found)
* /local/xxx/db/install.php - executed right after install.xml
* /local/xxx/db/uninstall.php - executed during uninstallation
* /local/xxx/db/upgrade.php - executed after version.php change
* /local/xxx/db/access.php - definition of capabilities
* /local/xxx/db/events.php - event handlers and subscripts
* /local/xxx/db/messages.php - messaging registration
* /local/xxx/db/services.php - definition of web services and web service functions
* /local/xxx/lang/en/local_pluginname.php - language file
* /local/pluginname/db/version.php - version of script (must be incremented after changes)
* /local/pluginname/db/install.xml - executed during install (new version.php found)
* /local/pluginname/db/install.php - executed right after install.xml
* /local/pluginname/db/uninstall.php - executed during uninstallation
* /local/pluginname/db/upgrade.php - executed after version.php change
* /local/pluginname/db/access.php - definition of capabilities
* /local/pluginname/db/events.php - event handlers and subscripts
* /local/pluginname/db/messages.php - messaging registration
* /local/pluginname/db/services.php - definition of web services and web service functions
* /local/pluginname/lang/en/local_pluginname.php - language file
* /local/pluginname/settings.php - admin settings
Local plugin version specification
@ -125,6 +126,19 @@ $ADMIN->add('root', new admin_category('tweaks', 'Custom tweaks'));
$ADMIN->add('tweaks', new admin_externalpage('nicehackery', 'Tweak something',
$CFG->wwwroot.'/local/nicehack/setuppage.php'));
Or if you want a new standard settings page for the plugin, inside a new
category at the top level called 'Local hacks', use the following:
<?php
defined('MOODLE_INTERNAL') || die;
if (!$ADMIN->locate('localhacks')) {
$ADMIN->add('root', new admin_category('localhacks', 'Local hacks'));
}
$settings = new admin_settingpage('local_pluginname', 'This plugin');
$ADMIN->add('localhacks', $settings);
$settings->add(new admin_setting_configtext('local_thisplugin/option',
'Option', 'Information about this option', 100, PARAM_INT));
Local plugin event handlers
---------------------------