You are here

public function UnpublishWorkspaceConstraintValidator::validate in Multiversion 8

File

src/Plugin/Validation/Constraint/UnpublishWorkspaceConstraintValidator.php, line 19

Class

UnpublishWorkspaceConstraintValidator
Checks if data still exists for a deleted workspace ID.

Namespace

Drupal\multiversion\Plugin\Validation\Constraint

Code

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);
  }
}