I have created a custom module that sets a system variable using variable_set(). I would like someone with the proper permissions to be able to edit this variable via the admin. I’m sure there are contributed modules that allow you to edit system variables, but I was looking for a way to include this functionality right in my custom module. I would like to maybe hook into the “Site Information” admin form or maybe the “File System” admin form and include a text field where they could edit this system variable and it would save. What’s the best way to go about this?
THANKS
The Site Information form uses
system_settings_form()which means you just need to add your variable as an element to the form (usinghook_form_alter()or, as in the following,hook_form_FORM_ID_alter()) and the system will handle saving it.Same thing goes for the
system_file_system_settings()form.