function fb_instant_articles_validate_ad_source_url in Facebook Instant Articles 7.2
Same name and namespace in other branches
- 7 includes/admin.inc \fb_instant_articles_validate_ad_source_url()
Validation handler for Ads Source URL
1 string reference to 'fb_instant_articles_validate_ad_source_url'
- fb_instant_articles_module_config_ads in includes/
admin.inc - Generates Ads sub-section of Module Configuration section
File
- includes/
admin.inc, line 192 - Settings for Facebook Instant Articles Base module.
Code
function fb_instant_articles_validate_ad_source_url($element, &$form_state, $form) {
// Only validate if Source URL is selected as ad type
if ($form_state['values']['fb_instant_articles_ad_type'] != FB_INSTANT_ARTICLES_AD_TYPE_SOURCE_URL) {
return;
}
if (empty($element['#value'])) {
form_error($element, t('You must specify a valid source URL for your Ads when using the Source URL ad type.'));
}
if (filter_var($element['#value'], FILTER_VALIDATE_URL) === FALSE) {
form_error($element, t('You must specify a valid source URL for your Ads when using the Source URL ad type.'));
}
}