You are here

class UnpublishWorkspaceConstraintValidator in Multiversion 8

Checks if data still exists for a deleted workspace ID.

Hierarchy

Expanded class hierarchy of UnpublishWorkspaceConstraintValidator

File

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

Namespace

Drupal\multiversion\Plugin\Validation\Constraint
View 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

Namesort descending Modifiers Type Description Overrides
UnpublishWorkspaceConstraintValidator::validate public function Checks if the passed value is valid.