You are here

function amp_admin_form_validate in Accelerated Mobile Pages (AMP) 7

Form validation handler for amp_admin_form().

See also

amp_admin_form_submit()

File

./amp.admin.inc, line 185
Administrative page callbacks for the AMP module.

Code

function amp_admin_form_validate($form, &$form_state) {

  // Validate the Google Adsense ID.
  if (!empty($form_state['values']['amp_google_adsense_id'])) {
    if (!preg_match('/^pub-[0-9]+$/', $form_state['values']['amp_google_adsense_id'])) {
      form_set_error('amp_google_adsense_id', t('A valid Google AdSense Publisher ID is case sensitive and formatted like pub-9999999999999'));
    }
  }
}