Hi
I'm using omega. I've already created a subtheme and customizing the theme setting form. I need to add a file upload field with the code below :
$form['theme_settings']['background_file'] = array(
'#type' => 'managed_file',
'#title' => t('Background'),
'#required' => FALSE,
'#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'),
),
);
The form displays the field but on submit, i got the following error :
Fatal error: Call to undefined function omega_extension_development_settings_form_submit() in /xxx/drupal/includes/form.inc on line 1465
Comments
Comment #1
fubhy commentedOk, patch incoming.
Comment #2
fubhy commentedPlease test if this patch fixes your problem.
Comment #3
mouhammed commented2: form-state-file-references.patch queued for re-testing.
Comment #4
fubhy commentedNo need to re-queue. It's green :)
Comment #5
mouhammed commentedThanks a lot for this patch.
It seem that the reference is duplicated. After adding the the patch and tested, I got this error message :
Fatal error: require_once(): Failed opening required '/path-to-web-directory/drupal//path-to-web-directory/drupal/profiles/recruiter/themes/omega/omega/template.php' (include_path='.:/usr/share/php:/usr/share/pear') in /path-to-web-directory/drupal/includes/form.inc on line 515The patch doesn't fixes the problem.
Comment #6
malcolm_p commentedRemoving the DRUPAL_ROOT from the $filename removes the above error for me.
Comment #7
damienmckennaI believe the problem persists in 4.x-dev, and there's no need to tag the issue "theme", that's kinda a given ;-)
Comment #8
robynlgreen commentedI ran into this bug today, following guidance from a core managed_file issue here: https://www.drupal.org/node/1862892
The patch in #2 worked, following the advice from #6 and not using DRUPAL_ROOT. I wasn't sure if it was safe to remove this from the file_exists() and require scope, so I prepared an updated patch with a new variable inside the conditional for form_state. It could be a bit cleaner if we could removed DRUPAL_ROOT from $filename, but the scope of that is a bit deeper than what I was testing against here so I'd have to defer on that to someone more involved.
Needs review, but this worked for my local and production build.