function ValidPathConstraintValidator::validate
File
-
core/
lib/ Drupal/ Core/ Path/ Plugin/ Validation/ Constraint/ ValidPathConstraintValidator.php, line 45
Class
- ValidPathConstraintValidator
- Constraint validator for validating system paths.
Namespace
Drupal\Core\Path\Plugin\Validation\ConstraintCode
public function validate($value, Constraint $constraint) {
if (!isset($value)) {
return;
}
$path = trim($value, '/');
if (!$this->pathValidator
->isValid($path)) {
$this->context
->addViolation($constraint->message, [
'%link_path' => $value,
]);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.