You are here

function video_embed_field_validate_dimensions in Video Embed Field 7.2

Validates the iframe CSS dimensions.

Parameters

array $element: The element to validate.

4 calls to video_embed_field_validate_dimensions()
video_embed_field_handler_brightcove_form_validate in video_embed_brightcove/video_embed_brightcove.module
Validates the form elements for the Brightcove configuration form.
video_embed_field_handler_facebook_form_validate in video_embed_facebook/video_embed_facebook.module
Validates the form elements for the Facebook video configuration form.
video_embed_field_handler_vimeo_form_validate in ./video_embed_field.handlers.inc
Validates the form elements for the Vimeo configuration form.
video_embed_field_handler_youtube_form_validate in ./video_embed_field.handlers.inc
Validates the form elements for the Youtube configuration form.

File

./video_embed_field.module, line 316
Provides a simple field for easily embedding videos from youtube or vimeo

Code

function video_embed_field_validate_dimensions($element) {
  if (!preg_match('/^(\\d*)(px|%)?$/', $element['width']['#value'], $results)) {
    form_error($element['width'], t('You should use a valid CSS value for width in @plugin plugin', array(
      '@plugin' => $element['#title'],
    )));
  }
  if (!preg_match('/^(\\d*)(px|%)?$/', $element['height']['#value'], $results)) {
    form_error($element['height'], t('You should use a valid CSS value for height in @plugin plugin', array(
      '@plugin' => $element['#title'],
    )));
  }
}