You are here

function dynamic_background_settings_form in Dynamic Background 7.2

The dynamic background administration settings form.

File

./dynamic_background.module, line 317
This module enables administrators to upload images used as background on the site. The selected background image link is exposed as either $background in the page.tpl file or as /background.css.

Code

function dynamic_background_settings_form() {
  $form['dynamic_background_setting'] = array(
    '#type' => 'fieldset',
    '#title' => t('Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );

  // Load default values.
  $default = variable_get('dynamic_background_setting', array());
  $form['dynamic_background_setting']['num_of_pictures'] = array(
    '#type' => 'select',
    '#description' => t('Enter the number of images that should be possible to upload.'),
    '#options' => array(
      'unlimited' => t('Unlimited'),
    ) + drupal_map_assoc(array(
      1,
      2,
      3,
      4,
      5,
      6,
      7,
      8,
      9,
      10,
      15,
      20,
      30,
    )),
    '#required' => TRUE,
    '#default_value' => isset($default['num_of_pictures']) ? $default['num_of_pictures'] : 'unlimited',
  );
  $form['dynamic_background_setting']['path'] = array(
    '#type' => 'textfield',
    '#title' => t('Upload path'),
    '#description' => t('The path inside the files folder to upload the images to.'),
    '#size' => 25,
    '#required' => TRUE,
    '#default_value' => isset($default['path']) ? $default['path'] : '',
  );
  $form['dynamic_background_setting']['extensions'] = array(
    '#type' => 'textfield',
    '#title' => t('Allowed file types'),
    '#description' => t('Allowed files extension to upload. The list should be seperated by spaces.'),
    '#size' => 30,
    '#required' => TRUE,
    '#default_value' => isset($default['extensions']) ? $default['extensions'] : 'jpg jpeg png',
  );

  // Add image style to the form.
  $form += dynamic_background_image_style_form('dynamic_background_image_style');

  // Add image behavior form.
  $form += dynamic_background_image_behaviour_form('dynamic_background_image_behaviour');

  // Set drupal system settings form and add validation function.
  $form['#validate'][] = 'dynamic_background_settings_form_validate';
  return $form;
}