You are here

function flickr_block_admin_settings_validate in Flickr 7

Validate user input.

1 string reference to 'flickr_block_admin_settings_validate'
flickr_block_form_flickr_admin_settings_alter in block/flickr_block.admin.inc
Implements hook_form_FORM_ID_alter().

File

block/flickr_block.admin.inc, line 71
The admin settings for the Flickr Block module.

Code

function flickr_block_admin_settings_validate($form, &$form_state) {

  // Validate refresh rate random blocks.
  $limit = trim($form_state['values']['flickr_block_refresh_random']);
  if (!is_numeric($limit) || $limit < 2) {
    form_set_error('flickr_block_refresh_random', t('Set a number from 2 to 999.'));
  }

  // Validate refresh rate other blocks.
  $limit = trim($form_state['values']['flickr_block_refresh_others']);
  if (!is_numeric($limit) || $limit < 2) {
    form_set_error('flickr_block_refresh_others', t('Set a number from 2 to 999.'));
  }

  // Validate photos per set.
  $limit = trim($form_state['values']['flickr_block_photos_per_set']);
  if (!ctype_digit($limit) || $limit < 1) {
    form_set_error('flickr_block_photos_per_set', t('Set an integer from 1 to 99.'));
  }
}