You are here

public function FieldValidationConstraint::__construct in Field Validation 8

File

src/Plugin/Validation/Constraint/FieldValidationConstraint.php, line 20

Class

FieldValidationConstraint
Checks that the node.

Namespace

Drupal\field_validation\Plugin\Validation\Constraint

Code

public function __construct($options = null) {
  if (is_array($options)) {
    if (key_exists('ruleset_name', $options)) {
      $this->ruleset_name = $options['ruleset_name'];
    }
    if (key_exists('rule_uuid', $options)) {
      $this->rule_uuid = $options['rule_uuid'];
    }
  }
  if (null !== $options && !is_array($options)) {
    $options = [
      'ruleset_name' => $options,
      'rule_uuid' => $options,
    ];
  }
  parent::__construct($options);
}