You are here

public function RegExValidationConstraint::__construct in RegEx Field Validation 1.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/Validation/Constraint/RegExValidationConstraint.php \Drupal\regex_field_validation\Plugin\Validation\Constraint\RegExValidationConstraint::__construct()
  2. 2.0.x src/Plugin/Validation/Constraint/RegExValidationConstraint.php \Drupal\regex_field_validation\Plugin\Validation\Constraint\RegExValidationConstraint::__construct()

Class constructor.

File

src/Plugin/Validation/Constraint/RegExValidationConstraint.php, line 22

Class

RegExValidationConstraint
Checks that the node.

Namespace

Drupal\regex_field_validation\Plugin\Validation\Constraint

Code

public function __construct($options = NULL) {
  if (!empty($options) && is_array($options)) {
    $options = [
      'regex' => $options['regex'],
      'errorMessage' => $options['errorMessage'],
    ];
    parent::__construct($options);
  }
  else {
    drupal_set_message('There was an issue with the RegExValidation module initialisation', 'error');
  }
}