Skip to content

New "Recipe" Project Type

Tim Erickson edited this page Aug 27, 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."
  4. Wizards
    • "I've always wanted core to provide an installer/wizard-like, step-by-step guide to make a site multilingual" (@klonos comment)

Status

As of today, the PR for https://github.com/backdrop/backdrop-issues/issues/3224 is RTBC which fixes a bug that was blocking a simple form of recipe that is basically a module with nothing but a .info file and config. With the commit of this PR into core, it will be relatively easy to create and install simple config recipes.

Here are two sample recipes for testing (these are config only modules):

However, at this point we still have no official policy on what a recipe is and/or how to manage them on BackdropCMS.org.

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).
    • @BWPanda - comment - "I think we can ditch the idea of 'recipes' being a new type of project that has a version and can be updated, uninstalled, etc. That's complicated (as discussed re. Drupal's Features module). I see recipes as being something you 'install' on an existing site - content types are created, Views are added, etc. Then the site acts just as if you had manually built those things yourself. You can disable or uninstall the individual parts. The recipe doesn't exist after it's been 'installed'."
  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)?
  4. Does this need to be a new project type or might it simply be a extension of the current configuration management feature (Comment by @laryn)

Resources:

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