public function FacebookEmbedCodeConstraintValidator::validate in Media entity facebook 8
Same name and namespace in other branches
- 8.2 src/Plugin/Validation/Constraint/FacebookEmbedCodeConstraintValidator.php \Drupal\media_entity_facebook\Plugin\Validation\Constraint\FacebookEmbedCodeConstraintValidator::validate()
- 3.x src/Plugin/Validation/Constraint/FacebookEmbedCodeConstraintValidator.php \Drupal\media_entity_facebook\Plugin\Validation\Constraint\FacebookEmbedCodeConstraintValidator::validate()
File
- src/
Plugin/ Validation/ Constraint/ FacebookEmbedCodeConstraintValidator.php, line 20
Class
- FacebookEmbedCodeConstraintValidator
- Validates the FacebookEmbedCode constraint.
Namespace
Drupal\media_entity_facebook\Plugin\Validation\ConstraintCode
public function validate($value, Constraint $constraint) {
$value = $this
->getEmbedCode($value);
if (!isset($value)) {
return;
}
$post_url = Facebook::parseFacebookEmbedField($value);
if ($post_url === FALSE) {
$this->context
->addViolation($constraint->message);
}
}