function Recipe::validateRecipeExists

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Recipe/Recipe.php \Drupal\Core\Recipe\Recipe::validateRecipeExists()

Validates that a recipe exists.

Parameters

string $name: The machine name of the recipe to look for.

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

string $include_path: The recipe's include path.

1 call to Recipe::validateRecipeExists()
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 237

Class

Recipe
@internal This API is experimental.

Namespace

Drupal\Core\Recipe

Code

private static function validateRecipeExists(string $name, ExecutionContextInterface $context, string $include_path) : void {
    if (empty($name)) {
        return;
    }
    try {
        RecipeConfigurator::getIncludedRecipe($include_path, $name);
    } catch (UnknownRecipeException) {
        $context->addViolation('The %name recipe does not exist.', [
            '%name' => $name,
        ]);
    }
}

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