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' => 'managed_file',
'#title' => t('Background'),
'#required' => True,
'#upload_location' => file_default_scheme() . '://theme/backgrounds/',
'#default_value' => theme_get_setting('background_file'),
'#upload_validators' => array(
'file_validate_extensions' => 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.