You are here

function EMMODULE_PROVIDER_validate in Embedded Media Field 6.3

Same name and namespace in other branches
  1. 6 hooks/emfield.php \EMMODULE_PROVIDER_validate()
  2. 6.2 hooks/emfield.php \EMMODULE_PROVIDER_validate()

Validate the provider's embedded code.

This allows each provider to determine whether a pasted URL that otherwise matches a parse attempt from EMMODULE_PROVIDER_extract is valid. For instance, the provider file might check against the third party provider's API to ensure a video still exists. If the validation is to fail, the function should call form_set_error with the provided $error_field.

Parameters

$code: The unique identifier for the third party media. @param $error_field The form field to use with form_set_error().

File

hooks/emfield.php, line 103
Document various hooks for Embedded Media Field.

Code

function EMMODULE_PROVIDER_validate($code, $error_field) {
  if (!_example_call_api('video_data', $code)) {
    form_set_error($error_field, t('That video no longer exists on example.com.'));
  }
}