function Recipe::createFromDirectory

Same name in other branches
  1. 11.x 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.

26 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.
install_recipe_batch in core/includes/install.core.inc
Creates a batch for the recipe system to process.
RecipeCommand::execute in core/lib/Drupal/Core/Recipe/RecipeCommand.php

... See full list

File

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

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'));
    $content = new Finder($path . '/content');
    return new static($recipe_data['name'], $recipe_data['description'], $recipe_data['type'], $recipes, $install, $config, $content, $path);
}

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