Permalink
Browse files

local NOBUG Improved my settings example (probably typical usage) in …

…local/readme.txt
  • Loading branch information...
1 parent cf5a0db commit 9ea98a6e15c7deb9b1f70809e4a3ef5ae196c249 @sammarshallou sammarshallou committed Dec 2, 2010
Showing with 8 additions and 9 deletions.
  1. +8 −9 local/readme.txt
View
@@ -126,19 +126,18 @@ $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:
+Or if you want a new standard settings page for the plugin, inside the local
+plugins category:
<?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);
+if ($hassiteconfig) { // needs this condition or there is error on login page
+ $settings = new admin_settingpage('local_thisplugin', 'This plugin');
+ $ADMIN->add('localplugins', $settings);
-$settings->add(new admin_setting_configtext('local_thisplugin/option',
- 'Option', 'Information about this option', 100, PARAM_INT));
+ $settings->add(new admin_setting_configtext('local_thisplugin/option',
+ 'Option', 'Information about this option', 100, PARAM_INT));
+}
Local plugin event handlers
---------------------------

0 comments on commit 9ea98a6

Please sign in to comment.