class UnpublishWorkspaceConstraintValidator in Multiversion 8
Checks if data still exists for a deleted workspace ID.
Hierarchy
- class \Drupal\multiversion\Plugin\Validation\Constraint\UnpublishWorkspaceConstraintValidator extends \Symfony\Component\Validator\ConstraintValidator
Expanded class hierarchy of UnpublishWorkspaceConstraintValidator
File
- src/
Plugin/ Validation/ Constraint/ UnpublishWorkspaceConstraintValidator.php, line 14
Namespace
Drupal\multiversion\Plugin\Validation\ConstraintView source
class UnpublishWorkspaceConstraintValidator extends ConstraintValidator {
/**
* {@inheritdoc}
*/
public function validate($value, Constraint $constraint) {
/** @var \Drupal\Core\Field\FieldItemListInterface $value */
if (!isset($value)) {
return;
}
if ($value
->getEntity()
->isDefaultWorkspace() && !$value->value) {
$this->context
->addViolation($constraint->message);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UnpublishWorkspaceConstraintValidator:: |
public | function | Checks if the passed value is valid. |