function Recipe::createFromDirectory

Same name in other branches
  1. 10 core/lib/Drupal/Core/Recipe/Recipe.php \Drupal\Core\Recipe\Recipe::createFromDirectory()

Creates a recipe object from the provided path.

Parameters

string $path: The path to a recipe.

Return value

static The Recipe object.

28 calls to Recipe::createFromDirectory()
ConfigActionValidationTest::testConfigActionDependenciesAreValidated in core/tests/Drupal/KernelTests/Core/Recipe/ConfigActionValidationTest.php
Tests validating that config actions' dependencies are present.
ConfigConfiguratorTest::testExistingConfigWithKeysInDifferentOrder in core/tests/Drupal/KernelTests/Core/Recipe/ConfigConfiguratorTest.php
ConfigValidationTest::createRecipeWithInvalidDataInFile in core/tests/Drupal/KernelTests/Core/Recipe/ConfigValidationTest.php
Creates a recipe with invalid config data in a particular file.
InputTest::setUp in core/tests/Drupal/KernelTests/Core/Recipe/InputTest.php
install_recipe_batch in core/includes/install.core.inc
Creates a batch for the recipe system to process.

... See full list

File

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

Class

Recipe
@internal This API is experimental.

Namespace

Drupal\Core\Recipe

Code

public static function createFromDirectory(string $path) : static {
    $recipe_data = self::parse($path . '/recipe.yml');
    $recipes = new RecipeConfigurator(is_array($recipe_data['recipes']) ? $recipe_data['recipes'] : [], dirname($path));
    $install = new InstallConfigurator($recipe_data['install'], \Drupal::service('extension.list.module'), \Drupal::service('extension.list.theme'));
    $config = new ConfigConfigurator($recipe_data['config'], $path, \Drupal::service('config.storage'));
    $input = new InputConfigurator($recipe_data['input'] ?? [], $recipes, basename($path), \Drupal::typedDataManager());
    $content = new Finder($path . '/content');
    return new static($recipe_data['name'], $recipe_data['description'], $recipe_data['type'], $recipes, $install, $config, $input, $content, $path);
}

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