You are here

function pmpapi_pull_pull_doc_by_guid_validate in Public Media Platform API Integration 7

Form validation handler for pmpapi_pull_pull_doc_by_guid().

See also

pmpapi_pull_pull_doc_by_guid_submit()

File

pmpapi_pull/pmpapi_pull.pages.inc, line 36

Code

function pmpapi_pull_pull_doc_by_guid_validate($form, &$form_state) {
  $guid = trim($form_state['values']['guid']);
  $pattern = '/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i';
  if (!preg_match($pattern, $guid)) {
    form_set_error('guid', t('Not a valid GUID.'));
  }
}