You are here

function _fb_likebox_validate_block_settings in Facebook Page Plugin 7.2

Same name and namespace in other branches
  1. 6.2 fb_likebox.module \_fb_likebox_validate_block_settings()
  2. 6 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.

1 string reference to '_fb_likebox_validate_block_settings'
fb_likebox_form_block_admin_configure_alter in ./fb_likebox.module
Implements hook_form_FORM_ID_alter().

File

./fb_likebox.module, line 172
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) < 180 || intval($fb_width) > 500) {
    form_set_error('fb_likebox_width', t('Width should be a number between 180 and 500, limits included.'));
  }
  $fb_height = $form_state['values']['fb_likebox_height'];
  if (!is_numeric($fb_height) || intval($fb_height) < 70) {
    form_set_error('fb_likebox_height', t('Height should be a number equal or larger than 70.'));
  }
}