You are here

function scald_youtube_validate_api_key in Scald YouTube 7

Form element validation handler for YouTube API key.

1 string reference to 'scald_youtube_validate_api_key'
scald_youtube_form_scald_admin_type_form_alter in ./scald_youtube.module
Implements hook_form_FORM_ID_alter().

File

./scald_youtube.module, line 691
Defines a YouTube provider for Scald.

Code

function scald_youtube_validate_api_key($element, &$form_state) {
  if (!empty($form_state['values']['scald_youtube_api_key']) && !preg_match('/^[a-zA-Z0-9_\\-]+$/', $form_state['values']['scald_youtube_api_key'])) {
    form_error($element, t('Invalid YouTube API Key.'));
  }
}