You are here

function fb_instant_articles_validate_ad_embed_code in Facebook Instant Articles 7

Same name and namespace in other branches
  1. 7.2 includes/admin.inc \fb_instant_articles_validate_ad_embed_code()

Validation handler for Ads Embed Code

1 string reference to 'fb_instant_articles_validate_ad_embed_code'
fb_instant_articles_module_config_ads in includes/admin.inc
Generates Ads sub-section of Module Configuration section

File

includes/admin.inc, line 202
Settings for Facebook Instant Articles Base module.

Code

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

  // Only validate if Embed Code is selected as ad type
  if ($form_state['values']['fb_instant_articles_ad_type'] != FB_INSTANT_ARTICLES_AD_TYPE_EMBED_CODE) {
    return;
  }
  if (empty($element['#value'])) {
    form_error($element, t('You must specify Embed Code for your Ads when using the Embed Code ad type.'));
  }
}