You are here

function _youtube_validate_video_width_and_height in Media: YouTube 7.3

Same name and namespace in other branches
  1. 7.2 includes/media_youtube.formatters.inc \_youtube_validate_video_width_and_height()

Validation for width and height.

1 string reference to '_youtube_validate_video_width_and_height'
media_youtube_file_formatter_video_settings in includes/media_youtube.formatters.inc
Implements hook_file_formatter_FORMATTER_settings().

File

includes/media_youtube.formatters.inc, line 224
File formatters for YouTube videos.

Code

function _youtube_validate_video_width_and_height($element, &$form_state, $form) {

  // Check if the value is a number with an optional decimal or percentage sign, or "auto".
  if (!empty($element['#value']) && !preg_match('/^(auto|([0-9]*(\\.[0-9]+)?%?))$/', $element['#value'])) {
    form_error($element, t("The value entered for @dimension is invalid. Please insert a unitless integer for pixels, a percent, or \"auto\". Note that percent and auto may not function correctly depending on the browser and doctype.", array(
      '@dimension' => $element['#title'],
    )));
  }
}