Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

local NOBUG Added another settings example (probably typical usage) t…

…o the excellent documentation about local plugins
  • Loading branch information...
commit 2528fe1408d489f39f01637a055ff411810bdf5b 1 parent bea9531
@sammarshallou sammarshallou authored
Showing with 24 additions and 10 deletions.
  1. +24 −10 local/readme.txt
View
34 local/readme.txt
@@ -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
---------------------------
Please sign in to comment.
Something went wrong with that request. Please try again.