function ConfigValidation::validateLlama

Same name in other branches
  1. 9 core/modules/config/tests/config_test/src/ConfigValidation.php \Drupal\config_test\ConfigValidation::validateLlama()
  2. 8.9.x core/modules/config/tests/config_test/src/ConfigValidation.php \Drupal\config_test\ConfigValidation::validateLlama()
  3. 11.x core/modules/config/tests/config_test/src/ConfigValidation.php \Drupal\config_test\ConfigValidation::validateLlama()

Validates a llama.

Parameters

string $string: The string to validate.

\Symfony\Component\Validator\Context\ExecutionContextInterface $context: The validation execution context.

File

core/modules/config/tests/config_test/src/ConfigValidation.php, line 20

Class

ConfigValidation
Provides a collection of validation callbacks for testing purposes.

Namespace

Drupal\config_test

Code

public static function validateLlama($string, ExecutionContextInterface $context) {
    if (!in_array($string, [
        'llama',
        'alpaca',
        'guanaco',
        'vicuña',
    ], TRUE)) {
        $context->addViolation('no valid llama');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.