class LanguageCombinationConstraintValidator in Translation Management Tool 8
Validates the ForumLeaf constraint.
Hierarchy
- class \Drupal\tmgmt_language_combination\Plugin\Validation\Constraint\LanguageCombinationConstraintValidator extends \Symfony\Component\Validator\ConstraintValidator
Expanded class hierarchy of LanguageCombinationConstraintValidator
File
- translators/
tmgmt_local/ skills/ src/ Plugin/ Validation/ Constraint/ LanguageCombinationConstraintValidator.php, line 11
Namespace
Drupal\tmgmt_language_combination\Plugin\Validation\ConstraintView source
class LanguageCombinationConstraintValidator extends ConstraintValidator {
/**
* {@inheritdoc}
*/
public function validate($value, Constraint $constraint) {
if ($value->language_from == $value->language_to) {
$this->context
->addViolation($constraint->noDifferentMessage);
}
foreach ($value
->getParent() as $combination) {
if ($combination->language_from == $value->language_from && $combination->language_to == $value->language_to) {
if ($value != $combination && $value
->getName() > $combination
->getName()) {
$this->context
->addViolation($constraint->uniqueMessage);
}
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LanguageCombinationConstraintValidator:: |
public | function | Checks if the passed value is valid. |