function IconPackManager::setValidator

Sets the validator service if available.

Parameters

\JsonSchema\Validator|null $validator: The JSON Validator class.

File

core/lib/Drupal/Core/Theme/Icon/Plugin/IconPackManager.php, line 195

Class

IconPackManager
Defines an icon pack plugin manager to deal with icons.

Namespace

Drupal\Core\Theme\Icon\Plugin

Code

public function setValidator(?Validator $validator = NULL) : void {
    if (NULL !== $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.