Skip to content

New "Recipe" Project Type

Tim Erickson edited this page Feb 2, 2021 · 10 revisions

This page is intended to be a place to summarize the discussion taking place in issue #3763

Summary:

The intent of this issue is to create a project type that might be best compared to the "Features" module for Drupal 7. A means of importing a mixture of content types, views, fields and other configuration to add specific functionality to an existing site.

Assumptions:

  1. Recipes are something that would be added after installation. Adding functionality to a site during the install process can currently be accomplished with an install profile.
  2. Recipes would probably require an ability to declare dependencies. A specific Recipe may require that a specific module has been installed or is installed at the time the Recipe is enabled.

Structure

The current working assumption is that a Recipe project would be defined by a .info file, much in the same way that modules, themes, layouts, and install profiles are. Included in the .info file would be some or all of the following:

  1. .info file
    • Module dependencies
    • Layout dependencies
    • Theme dependencies (???)
  2. Config
    • Are config files included directly in Recipe or just a link to source?
  3. What else would be included?

Examples:

Here is a list of examples of what might be included in a Recipe. This list need not be exhaustive, but should include good representation of the types of Recipes we might anticipate.

  1. FAQ Feature
    • Content Type
    • Necessary fields
    • Views
  2. Prefab Paragraphs
    • "that would allow people to click a button to configure a paragraph type -- but perhaps a core "recipe" module would allow some way to do this in a module? e.g. in this case, a recipe for a content type with certain paragraph types pre-configured, or just pre-configuring paragraph types in general (some of which may have dependencies on other modules)."
  3. Block Recipes
    • "Example: a block who's only function is to hold and display images. The recipe would create the content type (field type?) to hold the images and create the view with block to display the images."

Questions

  1. Is it possible to uninstall a Recipe? Creating an uninstall process could get complicated and may not be necessary. One way to think about Recipes is that the must be removed manually. We could require that any official Recipe comes with a Readme that includes all the changes the Recipe inflicts up on site (to make it easier for an end user to back these changes out if necessary).
  2. How to prevent duplication of machine names (avoid conflict with existing config)
  3. If dependencies are not present are they automatically downloaded and installed OR is the user notified about dependencies and asked if they wish to proceed, before the Recipe is installed (at which point dependencies would be downloaded)?

Resources:

  1. Some simple sample recipes - Proof of concept
  2. Config Batch Upload module - Proof of concept
  3. Blog post "Config Recipes for Backdrop CMS" - and Video
  4. Github issue: Add "Recipe" project type to Backdrop