function dynamic_background_admin_images in Dynamic Background 7
Same name and namespace in other branches
- 6 includes/backgrounds.admin.inc \dynamic_background_admin_images()
- 7.2 includes/backgrounds.admin.inc \dynamic_background_admin_images()
The image administation form.
1 string reference to 'dynamic_background_admin_images'
- dynamic_background_menu in ./
dynamic_background.module - Implements hook_menu().
File
- includes/
backgrounds.admin.inc, line 11 - Implementation of the administration image upload and selecton form.
Code
function dynamic_background_admin_images() {
$form = array();
// Load settings
$settings = variable_get('dynamic_background_setting', array());
if (empty($settings)) {
drupal_set_message(t('You have not yet configured "Dynamic background". Click <a href="@link">here</a> to configure it.', array(
'@link' => url('admin/config/user-interface/backgrounds/settings'),
)));
return;
}
// File upload form encoded.
$form['#attributes'] = array(
'enctype' => 'multipart/form-data',
);
// Load default values
$default = variable_get('dynamic_background_images', array());
for ($i = 0; $settings['num_of_pictures'] > $i; $i++) {
$form['dynamic_background_picture_' . $i] = array(
'#type' => 'background_upload_form',
'#title' => t('Background image %num', array(
'%num' => $i + 1,
)),
'#default_value' => isset($default[$i]) ? $default[$i] : array(),
);
}
// Give it system setting form style.
$form = system_settings_form($form);
unset($form['buttons']['reset']);
// Set validators and submit handler(s).
$form['#validate'][] = 'dynamic_background_admin_images_validate';
$form['#submit'] = array(
'dynamic_background_admin_images_submit',
);
return $form;
}