I'm building a site using the Nexus theme, and wanted to give users the ability to change the slideshow images using Drupal rather than using the default FTP (which is an odd way to make people update their slideshows). There are three images in the slideshow, and each one has its own theme settings for text and links, but not the images. By default they make you update the images by replacing them in the theme folder via FTP (or your preferred method of uploading files).
So for each image I added the following form field to the theme settings (replacing "slide1" with "slide2" and "slide3", respectively):
$form['nexus_settings']['slideshow']['slide1']['slide1_image'] = array(
'#title' => t('Image'),
'#type' => 'managed_file',
'#default_value' => variable_get('slide1_image', ''),
'#upload_location' => file_default_scheme() . '://slides',
);
Then I added code to make the files permanent. That all seems to be working well so far--for the most part. The problem is that if I replace only one of the images, the other two will disappear as soon as I hit the "Save configuration" button. It will only work properly if I update all three images at once.
It seems like even though the slideshow is loading the images correctly, the theme settings form doesn't save a record of them. So if the form is resubmitted without three images being present in the managed_file fields, any images that have not been updated will disappear.
How do I get them to save?
Thanks.
UPDATE: I tried the code example at this site with no luck. I'm not sure if that's the wrong thing for what I need or if I'm just not doing something properly.