You are here

function _fb_likebox_validate_block_settings in Facebook Page Plugin 6.2

Same name and namespace in other branches
  1. 6 fb_likebox.module \_fb_likebox_validate_block_settings()
  2. 7.2 fb_likebox.module \_fb_likebox_validate_block_settings()
  3. 7 fb_likebox.module \_fb_likebox_validate_block_settings()

Perform the validation of the block settings.

File

./fb_likebox.module, line 131
Simple module that provides a configurable block with Facebook Likebox's plugin.

Code

function _fb_likebox_validate_block_settings(&$form, $form_state) {

  // Facebook display settings validation.
  $fb_url = $form_state['values']['fb_likebox_url'];
  if (!valid_url($fb_url, TRUE)) {
    form_set_error('fb_likebox_url', t('Please enter a valid url.'));
  }

  // Facebook theming settings validation.
  $fb_width = $form_state['values']['fb_likebox_width'];
  if (!is_numeric($fb_width) || intval($fb_width) < 280 || intval($fb_width) > 500) {
    form_set_error('fb_likebox_width', t('Width should be a number between 280 and 500, limits included.'));
  }
  $fb_height = $form_state['values']['fb_likebox_height'];
  if (!is_numeric($fb_height) || intval($fb_height) < 130) {
    form_set_error('fb_likebox_height', t('Height should be a number bigger than 130.'));
  }
}