You are here

function facebook_comments_block_validate_absolute_url in Facebook Comments Block 7

Same name and namespace in other branches
  1. 7.2 facebook_comments_block.module \facebook_comments_block_validate_absolute_url()

Helper function to validate absolute URL.

1 string reference to 'facebook_comments_block_validate_absolute_url'
facebook_comments_block_block_configure in ./facebook_comments_block.module
Implements hook_block_configure().

File

./facebook_comments_block.module, line 280
Code for the Facebook Comments Block module.

Code

function facebook_comments_block_validate_absolute_url($element, &$form_state) {

  // trim trailing slash from the URL.
  $value = rtrim(rtrim($element['#value']), '/');
  if ($value !== '' && !valid_url($value, TRUE)) {
    form_error($element, t('%name must be a valid absolute URL.', array(
      '%name' => $element['#title'],
    )));
  }
}