robertgarrigos's picture

I'm saving a managed file in my theme settings page, but I need to mark it as permanent when submitting the form (https://docs.backdropcms.org/form_api#managed_file). I thought I could override system_theme_settings_submit() and build my own submit form to save all the theme settings values plus marking my file as permanent. But I guess that is not possible. There is a hook_form_system_theme_settings_alter() function, but it is called before system_theme_settings() sets the submit button. I could add a new submit button, but not override the one that already exists. Any solution for that?

Accepted answer

I answer myself:

Just add $form['#submit'] = array('my_submit form'); add the end of my hook_form_system_theme_settings_alter() function.

Make my_submit_form() function, which will do the logic for the managed file. Make sure you to include the logic of system_theme_settings_submit() function to save all other settings fields.

Comments

robertgarrigos's picture

I answer myself:

Just add $form['#submit'] = array('my_submit form'); add the end of my hook_form_system_theme_settings_alter() function.

Make my_submit_form() function, which will do the logic for the managed file. Make sure you to include the logic of system_theme_settings_submit() function to save all other settings fields.