function amp_analytics_admin_form_validate in Accelerated Mobile Pages (AMP) 7
Form validation handler for amp_admin_form().
See also
File
- modules/
amp_analytics/ amp_analytics.admin.inc, line 36 - Administrative page callbacks for the AMP analytics module.
Code
function amp_analytics_admin_form_validate($form, &$form_state) {
// Validate the Google Analytics ID.
if (!empty($form_state['values']['amp_google_analytics_id'])) {
if (!preg_match('/^UA-\\d+-\\d+$/', $form_state['values']['amp_google_analytics_id'])) {
form_set_error('amp_google_analytics_id', t('A valid Google Analytics Web Property ID is case sensitive and formatted like UA-xxxxxxx-yy.'));
}
}
}