Skip to main content
Image
Drupal Recipe Module Drupal Latest Initiative - Recipes OpenSense Labs

Drupal Recipe Module: What Is It & How It Works?

Drupal

Drupal 11 is now available, bringing new standards. The latest version combines code and design to enhance user experience. It features updates like CKEditor Autoformat and better block management, all designed for a smoother development process. Additionally, there are upgrades to the Drupal Recipe module as well. 

As Drupal grows and changes, the Recipe feature has become a key part of the platform. A Recipe looks at the idea of 'compossibility,' enabling users to build a Drupal website that meets their unique needs or, at the very least, offers a strong starting point.

In this blog, we’ll discuss Drupal 11’s Drupal Recipe module and how to best use it.   

If you are thinking about moving from your current content management system to Drupal, please check out our migration services before you continue.

Migrate To Drupal

Let us begin! 

Drupal Recipes Initiative: What Is It?  

The introduction of the Drupal icon into a sauté pan represents a new initiative by Drupal known as Drupal Recipes. This tool is intended for site builders and developers, allowing them to improve the functionality of a Drupal site.  

Drupal Recipes is similar to a cooking recipe. Drupal Recipes provides a set of ready-made configurations and components that help add new features easily. By using these recipes, developers can quickly create and improve Drupal sites while following best practices and encouraging code reuse.

Drupal Recipes can be added, removed, or mixed with different features at any point in the Drupal application's life. For instance, if you have a recipe for a specific type of site, like a blog or an online store, you can use it as a base for new projects. This approach saves time and ensures consistency across all your sites.

Drupal recipes offer more flexibility compared to distributions. While distributions are a collection of Drupal and other software components that are set up to work well together without much change, Drupal recipes allow you to easily replace or upgrade parts of your system. This means you are not stuck with a fixed setup.

Components Of A Recipe: 

  1. Profiles: These are ready-made setups meant for certain tasks, serving as the base of a recipe.  

  1. Features: Essential elements that enhance your site, like contact forms or online shopping options.  

  1. Configuration Keys: Every recipe has configuration keys that help with the setup, including:  

  • Name: The title of the recipe.  

  • Description: A summary of what the recipe does.  

  • Type: Classifies the recipe (e.g., Site, Content-Type, Feature). 

  • Install Instructions: Guidelines for organizing components.  

  • Config Actions: Guidelines for adjusting the look and functions of the site.

    Drupal Recipe Module Drupal Recipes Initiative OpenSense Labs

Also Check Out: 

  1. Plug & Play with New Drupal Recipes 
  2. Drupal 11: Eleven Changes & Updates In Drupal 11 
  3. Drupal 7 End Of Life: Top Reasons You Should Migrate To Drupal 10 
  4. What to do with your Drupal 7 website? 

Drupal Recipe Module: How To Install? 

Drupal Recipes focus on configuration, and are ‘declarative, not functional.’ Drupal Recipes can also be used with other Drupal recipes. For instance, a Drupal recipe that performs a specific task can be used with another Drupal recipe that does something different.   

Drupal Recipes can add modules with code, but they don’t include any code themselves. They utilize the configuration, not the code. When you install a Drupal recipe, it becomes part of your configuration. Also, there’s nothing to upgrade hence, an upgrade path is not needed.  

A recipe will have a folder similar to a Drupal module. Let's look at its folder layout. It includes a recipe.yml file and a configuration folder for your config files. Now, let's explore the details of the recipe.yml file structure: 

  • It starts by defining the recipe’s name, which is ‘Event’ in this case, and its type, labeled as “Content-type.”   

  • This also shows if the recipe is looking for other Drupal recipes. For instance, it looks for the "Event manager" recipe, which creates a user role with that name on the Drupal site and is located in the same folder as the "Event" recipe.   

  • The recipe then adds any necessary modules that are not yet installed on the website. In this case, it installs the Datetime range and Node modules. 

  • Lastly, there are Config Actions, this feature is powerful for changing an existing configuration. In this example, the config actions modify the ‘user.role.event_manager’ configuration by adding permissions to edit and delete any event content.  

You can create a full "Event" system by combining several smaller Drupal recipes into one larger recipe.

 

Drupal Recipe Module Recipe.yml File Structure OpenSense Labs

Drupal Recipe Module: How To Create A Drupal Recipe? 

To create a recipe, follow these steps:  

  1. Start Your Repository: Make a repository to organize and manage your recipes easily. 

  1. Outline Your Recipe Format: At the very least, have a recipe.yml file.  

  • List the modules you want to install under the install key.  

  • You can also add other recipes under the recipes key for better organization.  

  1. Here’s an example of a recipe.yml layout: 

 Drupal Recipe Module Example Recipe yml Structure 1 OpenSense Labs

Example of Drupal Recipe to install a module with custom configs 
Code Structure 

Drupal Recipe Module Example Recipe.yml Structure 2 OpenSense Labs

Here there are total three files  
Recipe.yml 
Composer.json 
Advagg.settings.yml 
 

Drupal Recipe Module Example Recipe.yml Structure 3 OpenSense Labs

Drupal Recipe Module Example Recipe.yml Structure 4 OpenSense Labs

Drupal Recipe Module Example Recipe.yml Structure 5 OpenSense Labs

This is an easy example of using a recipe.  
Here, we install a module through composer.json and activate it using install in recipe.yml. 

For custom settings, we keep our personalized configurations in the config folder, which are imported when we set up our recipe. 

Drupal Recipe Module: How It Works? 

To explain, let's say you want to create an Event feature. Here, you will use an ‘Events Content-Type' Recipe to establish an Event content type with the needed attributes and fields. This will also set up views, metatags, and paths for the Event content. This approach gives you a strong starting point, as 70-80% of the basic setup and configurations are handled by the Recipe.  

After that, you can customize additional settings to meet your needs. Once you apply the Recipe, you won't need it anymore, and you can remove it from your project while keeping all the configurations in place.

Before we move further in this blog – ensure a smooth transition to Drupal 10 with our expert services. Migrate to Drupal 10 before it’s too late! 

Migrate to Drupal 

Drupal Recipe Module: How Can It Benefit You? 

Drupal Recipes provides a lot of benefits like addressing issues with distributions by providing greater modularity. Rather than combining everything, Drupal Recipes allows you to select only the features you need, preventing the excess of unneeded Drupal modules. 

Let’s have a look at some more benefits of using Drupal Recipes:    

  1. Modular Setup: Drupal Recipes enable the addition of specific features or settings at any stage of a project. 

  1. Merge Different Drupal Recipes: You can easily mix or change Drupal recipes to suit your needs. This creates a more flexible site-building experience, helping you adjust to new demands. 

  1. No Lock-In: Drupal Recipes offer more flexibility compared to distributions, allowing you to change or upgrade parts of your setup without being stuck in a fixed system. 

  1. Composable: You can mix different Drupal recipes, making it simple to create new ones. If you need both Event registration and Commerce features, you can easily make a new recipe that includes both the Event and Commerce recipes.

Drupal Recipe MOdule Benefits of using Drupal Recipes OpenSense Labs

Drupal 11 Recipes: How Is It Different From Drupal 10? 

With Drupal 10, the Drupal Recipe module brought a new method to replace old distributions and install profiles. This Drupal Recipe module was designed for Drupal 10 and allowed for flexible and site-specific installations. Users could efficiently create custom setups by separating them from their original base. However the Distributions and Recipes Initiative in Drupal 10 was in its beginning phase. 

The Drupal Recipe module in Drupal 10 allowed users to quickly add functions to their website using a set of ready-made settings. A recipe can include anything configurable in Drupal, from a basic content type to a complete set of features. You can make your Drupal recipes to share or use, or you can use Drupal recipes made by other Drupal users. While Drupal recipes are still experimental in this version, they are functional and stable in version 11.1. 

Recipes in Drupal 11 is an updated version for site builders and developers. They provide more flexibility, modularity, and easier maintenance than traditional installation profiles and distributions. When starting a new Drupal site or adding features, Recipes makes managing the configuration simple and efficient. 

Drupal Recipes are changing to make Drupal site development faster and better for meeting new needs. This will help make Drupal easier and more powerful for everyone.  

You can either create them from the ground up or use Drupal Recipes. It's up to you! 

Also Check Out:  

  1. SDC: Integrating Storybook & Single Directory Component 
  2. DrupalCon Barcelona: 2024 Wrap-Up From Europe 
  3. RFP: How To Create An RFP For Open Source Solutions? 
  4. Drupal's Omnichannel Capabilities: Enhancing Customer Engagement and Experience 

Key Takeaways

  1. Drupal Recipes provides a set of ready-made configurations and components that can be used to effectively add new features. 

  2. Drupal Recipes can be added, removed, or mixed with different features at any point in the Drupal application's lifecycle. 

  1. After applying the Recipe, it is no longer needed and can be removed from the project while retaining all the configurations. 

  1. Drupal Recipes provide greater flexibility than distributions, enabling you to modify or upgrade components of your setup without being confined to a set system. 

  1. Drupal 11 recipes offer greater flexibility, modularity, and simpler maintenance compared to traditional installation profiles and distributions. 

 

Subscribe

Ready to start your digital transformation journey with us?

Related Blogs

SDC: Integrating Storybook & Single Directory Component

Integrating SDC With Storybook OpenSense Labs

Today, we will talk about about Drupal Single Directory Components or SDC and Storybook. Single Directory Components in Drupal allows you…

RFP: How To Create An RFP For Open Source Solutions?

RFP OpenSense Labs

A good Request for Proposals (RFP) or Call for Proposals (CFP) clearly states the goals and expectations of your project and sets the…

Drupal 7 End Of Life: Top Reasons You Should Migrate To Drupal 10

Drupal 7 End Of Life Cover Image OpenSense Labs

Drupal 10 was released in December 2022 and ever since, the community has been pushing its users to do Drupal 7 to 10 migration. As per…