You are here

function dynamic_background_admin_settings in Dynamic Background 6

Same name and namespace in other branches
  1. 7 includes/settings.admin.inc \dynamic_background_admin_settings()

The dynamic background administration settings form.

1 string reference to 'dynamic_background_admin_settings'
dynamic_background_menu in ./dynamic_background.module
Implementation of hook_menu().

File

includes/settings.admin.inc, line 12
Implementation of the administration settings form for the module.

Code

function dynamic_background_admin_settings() {
  $form = array(
    '#tree' => TRUE,
  );

  // Load default values
  $default = variable_get('dynamic_background_setting', array());
  $form['dynamic_background_setting']['num_of_pictures'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of images'),
    '#description' => t('Enter the number of images that are possible to upload.'),
    '#size' => 8,
    '#required' => TRUE,
    '#default_value' => isset($default['num_of_pictures']) ? $default['num_of_pictures'] : '',
  );
  $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 imagecache present to the form.
  $form += dynamic_background_image_presents_form('dynamic_background_imagecache');

  // Add css behaviour form to the form.
  $form += dynamic_background_css_behaviour_form('dynamic_background_css');

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