function ValidPathConstraintValidator::validate
Same name in other branches
- 9 core/lib/Drupal/Core/Path/Plugin/Validation/Constraint/ValidPathConstraintValidator.php \Drupal\Core\Path\Plugin\Validation\Constraint\ValidPathConstraintValidator::validate()
- 8.9.x core/lib/Drupal/Core/Path/Plugin/Validation/Constraint/ValidPathConstraintValidator.php \Drupal\Core\Path\Plugin\Validation\Constraint\ValidPathConstraintValidator::validate()
- 11.x core/lib/Drupal/Core/Path/Plugin/Validation/Constraint/ValidPathConstraintValidator.php \Drupal\Core\Path\Plugin\Validation\Constraint\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.