General developer forum

Implementing Admin Settings pages, etc

 
 
Picture of Joshua Johnston
Re: Implementing Admin Settings pages, etc
 

What is the preferred way to create a settings page for a plugin that has a hierarchy of settings that should be enabled/disabled based on the value of a parent setting?

Do I need to create an external settings page, how does that work? Can someone point me to the docs or an example in moodle of doing something like this? I am at a loss here.

 
Average of ratings: -
Picture of Jitendra Gaur
Re: Implementing Admin Settings pages, etc
 
Average of ratings: -
Picture of Joshua Johnston
Re: Implementing Admin Settings pages, etc
 

I was hoping to find an example or documentation of how to make a group of settings that would be enabled/disabled based upon a checkbox on the same settings page. The wiki page says to find an example in the existing settings and copy it but I cannot find one nor any reference to creating one "The Moodle Way"

Am I just missing it because of being new to Moodle or has this not been done?

 
Average of ratings: -
Picture of Jitendra Gaur
Re: Implementing Admin Settings pages, etc
 

Hi Joshua,

you can use  external admin page and create a form if you dont want to use standart admin setting functions.

moodle form has a function called ($mform->disabledIf())

In which you can mention the condition.

Hope it will help you.

Thanks

 
Average of ratings: -
Picture of Shawn Drake
Re: Implementing Admin Settings pages, etc
 

Hi Joshua,

I am currently looking for a way to do the exact same type of thing with my plugin. You are correct that it is either not a part of the "Moodle Way" at this point, or it's terribly hard to find the documentation to support it.... or even an example of it. 

What was your solution to the problem? I thought about doing it the way Jitendra mentions, but I'd much prefer to do it on the admin settings page. 

 
Average of ratings: -
Picture of Aaron Leggett
Re: Implementing Admin Settings pages, etc
 

Hey Shawn,
I am developing a block for Moodle 2.6 and was wondering if you ever found the resolution to this issue.
I want to disable a text-area in the admin settings dependant on whether a checkbox is selected or not.

Any help would be great!

 
Average of ratings: -
Picture of dawn alderson
Re: Implementing Admin Settings pages, etc
 

phew! busy bee/busy brain this evening...sorry!

I think once there is a solution...workaround for this and associated stuff......a specific area/library-you know a type of resource centre- in docs arena would bode well for others-prob come along with the opitmised navigation focus...on its way wink....maybe- particularly for those learning about such stuff smile

a little thought, from a little person big grin

Dawn

 

 
Average of ratings: -
Picture of Aaron Leggett
Re: Implementing Admin Settings pages, etc
 

It would be great to get some further documentation on this page as it is quite limited.
http://docs.moodle.org/dev/Admin_settings

I found this link quite useful whilst trying to add different types of settings, eg textarea's TinyMCE editors and so on.
https://moodle.org/mod/forum/discuss.php?d=259698

I am in dire need of the functionality to disable a TinyMCE editior dependant on whether a checkbox_with_adv is selected or not. This functionality is included in the instance settings (edit_form.php) so I expected it to already be here also.
http://docs.moodle.org/dev/lib/formslib.php_Form_Definition#disabledIf

Does anyone have any further info regarding this?


 
Average of ratings: -
Picture of Aaron Leggett
Re: Implementing Admin Settings pages, etc
 

I eventually ended up including the module js file in the settings page with

$this->requires->js('path/to/js/file')

Unfortunately it is harder than expected to disable a tinyMCE even through JS so I scrapped the idea

 
Average of ratings: -
Picture of Shawn Drake
Re: Implementing Admin Settings pages, etc
 

FYI, I found this post which was very helpful: https://moodle.org/mod/forum/discuss.php?d=169124)

 
Average of ratings: -