You are here

function acquia_lift_admin_form_validate in Acquia Lift Connector 7.3

Same name and namespace in other branches
  1. 7 acquia_lift.admin.inc \acquia_lift_admin_form_validate()
  2. 7.2 acquia_lift.admin.inc \acquia_lift_admin_form_validate()

File

./acquia_lift.admin.inc, line 306
acquia_lift.admin.inc Provides functions needed for the admin UI.

Code

function acquia_lift_admin_form_validate($form, &$form_state) {
  if (!preg_match('/^[a-zA-Z_][a-zA-Z\\d_]*$/', $form_state['values']['acquia_lift_account_id'])) {
    form_set_error('acquia_lift_account_id', t('Account ID contains invalid characters.  It has to start with a letter and contain only alphanumerical characters.'));
  }
  if (!empty($form_state['values']['acquia_lift_assets_url']) && !valid_url($form_state['values']['acquia_lift_assets_url'])) {
    form_set_error('acquia_lift_assets_url', t('Assets URL is an invalid URL.'));
  }
  if (!empty($form_state['values']['acquia_lift_decision_api_url']) && !valid_url($form_state['values']['acquia_lift_decision_api_url'])) {
    form_set_error('acquia_lift_decision_api_url', t('Decision API URL is an invalid URL.'));
  }
  if (!empty($form_state['values']['acquia_lift_oauth_url']) && !valid_url($form_state['values']['acquia_lift_oauth_url'])) {
    form_set_error('acquia_lift_oauth_url', t('Authentication URL is an invalid URL.'));
  }
  if (!empty($form_state['values']['acquia_lift_content_origin']) && !(bool) preg_match('/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/', $form_state['values']['acquia_lift_content_origin'])) {
    form_set_error('acquia_lift_content_origin', t('Content Hub Origin Site UUID is not a valid UUID.'));
  }
}