function Recipe::validateDefaultValueDefinition

Validates the definition of an input's default value.

Parameters

array $definition: The array to validate (part of a single input definition).

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

See also

::parse()

1 call to Recipe::validateDefaultValueDefinition()
Recipe::parse in core/lib/Drupal/Core/Recipe/Recipe.php
Parses and validates a recipe.yml file.

File

core/lib/Drupal/Core/Recipe/Recipe.php, line 314

Class

Recipe
@internal This API is experimental.

Namespace

Drupal\Core\Recipe

Code

public static function validateDefaultValueDefinition(array $definition, ExecutionContextInterface $context) : void {
    $source = $definition['source'];
    if (!array_key_exists($source, $definition)) {
        $context->addViolation("The '{$source}' key is required.");
    }
}

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