Upload Image in system_theme_settings form using Zen on Domain Access System I want to upload the image as the background in the settings page of the zen theme.

In zen , It's easy to add an extra field in the theme-settings.php and it's worked at the single site system.

However,I want to add this feature to the domain access Website.

And I got some error message.

I just write the code as belowed:

$form['background_file'] = array(
    '#type'     =&gt; 'managed_file',
    '#title'    =&gt; t('Background'),
    '#required' =&gt; True,
    '#upload_location' =&gt; file_default_scheme() . '://theme/backgrounds/',
    '#default_value' =&gt; theme_get_setting('background_file'), 
    '#upload_validators' =&gt; array(
      'file_validate_extensions' =&gt; array('gif png jpg jpeg'),
    ),
  );




picture above appeared correct.

But when i push the upload button.

I got the error message belowed



Notice: Undefined index: system_theme_settings in drupal_retrieve_form() (line 806 of /Library/WebServer/Documents/official/includes/form.inc).
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'system_theme_settings' not found or invalid function name in drupal_retrieve_form() (line 841 of /Library/WebServer/Documents/official/includes/form.inc).
Notice: Undefined index: var in variable_realm_form_system_theme_settings_alter() (line 618 of /Library/WebServer/Documents/official/sites/all/modules/variable/variable_realm/variable_realm.module).
Notice: Undefined index: background_file in file_ajax_upload() (line 271 of /Library/WebServer/Documents/official/modules/file/file.module).
Notice: Undefined index: #suffix in file_ajax_upload() (line 280 of /Library/WebServer/Documents/official/modules/file/file.module).



and i really don't know how to fix that.

I just referenced the content below and i can't find the answer.


https://stackoverflow.com/questions/7739345/drupal-7-retain-file-upload
https://stackoverflow.com/questions/11515221/is-there-a-proper-drupal-7-form-api-managed-file-tutorial
http://www.rahulsingla.com/blog/2011/06/drupal-7-handling-file-uploads-and-moving-files-to-the-public-file-system
Is there a way to add managed_file field to theme-settings.php?


Does someone fixed this situation before?

thanks a lot.
The form needs to be able to find system_theme_settings() when getting rebuilt via ajax. 

form_load_include($form_state, 'inc', 'system', 'system.admin'); inside of theme-settings.php hook_form_system_theme_settings_alter() should do the trick.