class OEmbedResourceConstraint
Same name in other branches
- 8.9.x core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraint.php \Drupal\media\Plugin\Validation\Constraint\OEmbedResourceConstraint
- 10 core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraint.php \Drupal\media\Plugin\Validation\Constraint\OEmbedResourceConstraint
- 11.x core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraint.php \Drupal\media\Plugin\Validation\Constraint\OEmbedResourceConstraint
Checks if a value represents a valid oEmbed resource URL.
@internal This is an internal part of the oEmbed system and should only be used by oEmbed-related code in Drupal core.
Plugin annotation
@Constraint(
id = "oembed_resource",
label = @Translation("oEmbed resource", context = "Validation"),
type = {"link", "string", "string_long"}
)
Hierarchy
- class \Drupal\media\Plugin\Validation\Constraint\OEmbedResourceConstraint extends \Symfony\Component\Validator\Constraint
Expanded class hierarchy of OEmbedResourceConstraint
1 file declares its use of OEmbedResourceConstraint
- OEmbedResourceConstraintValidatorTest.php in core/
modules/ media/ tests/ src/ Kernel/ OEmbedResourceConstraintValidatorTest.php
File
-
core/
modules/ media/ src/ Plugin/ Validation/ Constraint/ OEmbedResourceConstraint.php, line 20
Namespace
Drupal\media\Plugin\Validation\ConstraintView source
class OEmbedResourceConstraint extends Constraint {
/**
* The error message if the URL does not match any known provider.
*
* @var string
*/
public $unknownProviderMessage = 'The given URL does not match any known oEmbed providers.';
/**
* The error message if the URL matches a disallowed provider.
*
* @var string
*/
public $disallowedProviderMessage = 'Sorry, the @name provider is not allowed.';
/**
* The error message if the URL is not a valid oEmbed resource.
*
* @var string
*/
public $invalidResourceMessage = 'The provided URL does not represent a valid oEmbed resource.';
/**
* The error message if an unexpected behavior occurs.
*
* @var string
*/
public $providerErrorMessage = 'An error occurred while trying to retrieve the oEmbed provider database.';
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
OEmbedResourceConstraint::$disallowedProviderMessage | public | property | The error message if the URL matches a disallowed provider. |
OEmbedResourceConstraint::$invalidResourceMessage | public | property | The error message if the URL is not a valid oEmbed resource. |
OEmbedResourceConstraint::$providerErrorMessage | public | property | The error message if an unexpected behavior occurs. |
OEmbedResourceConstraint::$unknownProviderMessage | public | property | The error message if the URL does not match any known provider. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.