function fb_instant_articles_validate_an_placement_id in Facebook Instant Articles 7.2
Same name and namespace in other branches
- 7 includes/admin.inc \fb_instant_articles_validate_an_placement_id()
Validation handler for Audience Network Placement ID
1 string reference to 'fb_instant_articles_validate_an_placement_id'
- fb_instant_articles_module_config_ads in includes/
admin.inc - Generates Ads sub-section of Module Configuration section
File
- includes/
admin.inc, line 174 - Settings for Facebook Instant Articles Base module.
Code
function fb_instant_articles_validate_an_placement_id($element, &$form_state, $form) {
// Only validate if Audience Network is selected as ad type
if ($form_state['values']['fb_instant_articles_ad_type'] != FB_INSTANT_ARTICLES_AD_TYPE_FBAN) {
return;
}
if (empty($element['#value'])) {
form_error($element, t('You must specify a valid Placement ID when using the Audience Network ad type.'));
}
if (preg_match('/^[\\d_]+$/', $element['#value']) !== 1) {
form_error($element, t('You must specify a valid Placement ID when using the Audience Network ad type.'));
}
}