function ComponentValidator::setValidator
Sets the validator service if available.
File
- 
              core/
lib/ Drupal/ Core/ Theme/ Component/ ComponentValidator.php, line 28  
Class
- ComponentValidator
 - Validates a component based on its definition and the component schema.
 
Namespace
Drupal\Core\Theme\ComponentCode
public function setValidator(?Validator $validator = NULL) : void {
  if ($validator) {
    $this->validator = $validator;
    return;
  }
  if (class_exists(Validator::class)) {
    $this->validator = new Validator();
  }
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.