Error when developing a settings.php file for auth plugin

Error when developing a settings.php file for auth plugin

by Kais A -
Number of replies: 0

Hi,

I am updating an authentication plugin to use settings.php instead of config.php file. (Requirement since Moodle 3.3)

To do so I am following this guide: https://docs.moodle.org/dev/Creating_a_theme_settings_page

I get an error when I put my settings in the newly created settings.php file.  Error below:

Section error!

Debug info:

Error code: sectionerror

Stack trace: line 482 of /lib/setuplib.php: moodle_exception thrown

line 26 of /admin/settings.php: call to print_error()


This is what I get on the more information link:

error/admin/sectionerror

The error means that a new admin page 'foo' (the one you're developing right now) is not registered with the Admin menu. It is triggered with the call:

admin_externalpage_setup('foo');

The solution is to add a reference to the page in the appropriate file in admin/settings/XXX.php. Something like:

$ADMIN->add("parent_section", new admin_externalpage('foo', "Foo Admin Component", "$CFG->wwwroot/$CFG->admin/foo.php"));

I found two previous posts about the same issue, but none of them helped: 

https://moodle.org/mod/forum/discuss.php?d=336616

https://moodle.org/mod/forum/discuss.php?d=336702

Any help is much appreciated.

Thanks 


Average of ratings: -