3 namespace Drupal\media\Plugin\Validation\Constraint;
5 use Symfony\Component\Validator\Constraint;
8 * Checks if a value represents a valid oEmbed resource URL.
11 * This is an internal part of the oEmbed system and should only be used by
12 * oEmbed-related code in Drupal core.
15 * id = "oembed_resource",
16 * label = @Translation("oEmbed resource", context = "Validation"),
17 * type = {"link", "string", "string_long"}
20 class OEmbedResourceConstraint extends Constraint {
23 * The error message if the URL does not match any known provider.
27 public $unknownProviderMessage = 'The given URL does not match any known oEmbed providers.';
30 * The error message if the URL matches a disallowed provider.
34 public $disallowedProviderMessage = 'Sorry, the @name provider is not allowed.';
37 * The error message if the URL is not a valid oEmbed resource.
41 public $invalidResourceMessage = 'The provided URL does not represent a valid oEmbed resource.';
44 * The error message if an unexpected behavior occurs.
48 public $providerErrorMessage = 'An error occurred while trying to retrieve the oEmbed provider database.';