Digitalprojex logo

Recipes: The New Concept of Drupal 10.

The recipes are a new concept in Drupal 10, designed to replace the previous approach of distribution or installation profile for websites.
recipes drrupal 10

Recipes in Drupal are predefined configurations that allow for the quick and easy installation and configuration of websites. By using recipes in Drupal, users can save time and effort in the initial setup of their site, as they have a solid and optimized foundation to meet their needs. Today, we invite you to delve deeper and learn about this new option in Drupal.

Recipes are a new concept in Drupal 10, designed to replace the previous approach of distributions or installation profiles for websites. Their goal is to decouple an installation from its base to make them more manageable and tailored to the specific needs of the site. They were added to the core in Drupal 10.3 as experimental.

Core recipes can be found in /core/recipes. Custom and contributed recipes are stored in /recipes.

Main Features of Recipes

The main features of recipes are:
- Act as scripts: They leave no trace and do not remain active during the site's life, having no impact on performance and being reversible.
- Code installation: They can install modules and themes through dependencies but do not contain PHP files.
- Configuration modification: They can make changes to existing configurations through configuration actions without the need for programming.

 Structure of a Drupal Recipe

In the folder containing a recipe, you will find at least one `recipe.yml` file with the following structure:

```yaml
# Visible name of the recipe, as it will be listed.
name: 'Example recipe'
# Optional description of the functionality it provides.
description: "An example Drupal recipe."
# Type is similar to the package in modules, grouping recipes by utility criteria.
# Type 'Content type' means the recipe will be listed as an option in the installer.
type: 'Content type'
recipes:
 # If the recipe depends on others, they will be listed here. All will be applied before itself.
 - editorial_ui_for_publishers
 - another_recipe
install:
 # General dependencies (modules or themes) of the recipe.
 - easy_breadcrumb
 - node
 - text
config:
 # The recipe can control which configuration entities to install or not from those provided by the modules listed in its dependencies.
 # These examples are fictitious.
 import:
   easy_breadcrumb:
     - views.view.easy_breadcrumbs
   node:
     - node.type.article
   text: *
 # Actions on existing configuration. Declares the name of the configuration to be addressed, the specific action to be performed (done by a plugin), and possible arguments.
 # In the example, the user role 'Editor' will be created if it doesn’t exist and will then be granted several permissions to work on the Article content type.
 actions:
   user.role.editor:
     ensure_exists:
       label: 'Editor'
     grantPermissions:
       - 'delete any article content'
       - 'edit any article content'
```

If a recipe needs to install new configuration, it is saved in a folder called "config". Each configuration entry is stored in a YAML (.yml) file whose name matches the defined element. All configuration provided by a recipe is installed unconditionally, hence there are no subfolders like "config/install" or "config/optional".

Additionally, recipes incorporate a new API that facilitates the modification of existing configurations using a declarative syntax. This API is independent of recipes and can be used by other modules to make configuration changes without requiring programming.

The recipe development team encourages its use in development environments due to the low risk involved. Since no significant changes are expected in the already implemented structure, it is unlikely that recipes built now will require review.

To use the recipes, extensive patches are provided for their application in maintained versions of Drupal 10, minimizing collisions with other patches. Additionally, a set of Drupal recipes is available for exploration and contribution.

Application of Recipes

Recipes are applied using the core PHP script of Drupal. Change directory to your webroot and execute:

```bash
php core/scripts/drupal recipe recipes/contrib/[recipe-name]
```

Although there is no specific date for the stable version of Drupal recipes, a team is actively working on their mid-term implementation. They are likely to be integrated into a minor update of Drupal 10 or, at most, with the arrival of Drupal 11. This implies adjustments in infrastructure, including the creation of a new type of extension and its corresponding search feature on drupal.org.

Recipes are still under development and present certain limitations. Currently, they do not have a system to manage updates once applied, making it difficult to establish a clear lifecycle. It is suggested to apply them only once and manage any subsequent changes in another way.

Initially known as "starter templates," their main purpose is to provide a starting point for new projects. They are expected to replace the installation profiles of Drupal, such as Standard or Umami, representing an evolution of these. The best way to leverage this capability of Drupal will depend on the user experience.

We hope you find this new proposal from Drupal valuable. If you wish to deepen your knowledge of this powerful content management platform, we invite you to contact our team of experts at DigitalProjex. Our professionals will be happy to provide you with personalized consulting and guide you through the next steps to successfully integrate Drupal into your digital ecosystem. Feel free to schedule a meeting to discuss how Drupal can transform and enhance your online presence.

About DigitalProjex

DigitalProjex is a company dedicated to developing and implementing IT solutions.

Know more
Our team

Our team is composed of professionals specialized in Information Technologies.

What we offer

Development of useful and efficient solutions that allow you to automate your processes and promote technological innovation in your business.