You are here

function dynamic_background_admin_settings_validate in Dynamic Background 7

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

Validation function for the administration settings form.

1 string reference to 'dynamic_background_admin_settings_validate'
dynamic_background_admin_settings in includes/settings.admin.inc
The dynamic background administration settings form.

File

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

Code

function dynamic_background_admin_settings_validate($form, &$form_state) {

  // Validate number of images
  if (!is_numeric($form_state['values']['dynamic_background_setting']['num_of_pictures'])) {
    form_set_error('num_of_pictures', t('Please enter a number.'));
  }

  // Create upload path
  $path = file_default_scheme() . '://' . check_plain($form_state['values']['dynamic_background_setting']['path']);
  if (!file_prepare_directory($path, FILE_CREATE_DIRECTORY)) {
    form_set_error('path', t('The entered path could not be created.'));
  }

  /**
   * @todo Check that extension is only numbers and letters
   */
}