1 of 41

KANOPI STUDIOS

Drupal Distributions & Recipes Initiative Update

DrupalCon Pittsburgh | June 2023

Design4Drupal | July 2023

jimbir.ch/drupal-recipes

Drupal Distributions & Recipes Initiative Update | 1

2 of 41

Jim Birch (he/him)

Engineering Manager

  • Maintainer of Modules
    • Bootstrap Paragraphs
    • Bootstrap Pages
    • SEO Starter
  • Former Organizer of Drupal Chicago & MidCamp
  • Recipes “Initiative Coordinator”

Engineering Manager

@thejimbirch

jim@kanopi.com

KANOPI STUDIOS

Drupal Distributions & Recipes Initiative Update | 2

3 of 41

We’re hiring!

https://kanopi.com/careers/

Kanopi

kan·​o·​pi | \ˈka-nə-pē

  • Contract Drupal Developer

Kanopi designs, builds �and supports websites for clients who want to make a positive impact.

Our holistic approach infuses strategy and creative thinking through all stages of your site’s lifecycle, providing the tools �you need to nourish, support, and grow your business.

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 3

4 of 41

Last year in Portland…

Dries presented the idea of “Starter templates” to help ambitions site builders quickly and easily build out solutions.

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 4

5 of 41

Alex Pott @ DrupalCon Prague 2022

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 5

6 of 41

The problem

7 of 41

Maintaining Distributions & Install Profiles is hard

  • Can only start with it
  • Can't uninstall it
  • Need to maintain all dependencies

KANOPI STUDIOS

A Tour of Drupal Tours | 7

8 of 41

Other Solutions like Features

  • Hard to share like distributions
  • Because so complex, nearly impossible to get into core

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 8

9 of 41

Other Solutions like Features & Custom modules

  • Hard to share like distributions
  • Because so complex, nearly impossible to get into core
  • Need update hooks or manual steps to alter core and other contrib module's config

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 9

10 of 41

Drupal Recipes

11 of 41

Drupal Recipes�Order of Process

  • Install modules/themes
  • Create/update configuration
  • Create content (eventually)
  • Apply other recipes

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 11

12 of 41

Drupal Recipes�What they don’t do.

  • Have their own code
  • Make dynamic changes
  • Provide their own upgrade path (functionality is now part of the site)

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 12

13 of 41

Drupal Recipes�What if I need more Pre and Post?

  • Just add another Recipe
  • There are no hooks
  • Keeps it as simple as possible

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 13

14 of 41

Everything is subject to change!

This initiative, while a year old, is still in its infancy. Your input in it’s direction is welcome!

Photo by Cyrus Chew

KANOPI STUDIOS

A Tour of Drupal Tours | 14

15 of 41

The Recipes

16 of 41

Recipe structure

  • event_recipe
    • composer.json
    • logo.png
    • recipe.yml
    • config
      • node.type.event.yml
    • content
      • file
        • 245e8a22-b42d-41e0-94f4-f287d7dc509f.yml
        • image.jpg
      • media
        • 03bbb731-1f2d-42e9-84f2-e3fbb98e3af7.yml
      • node
        • 49551706-ded7-4e4a-9135-f60860193176.yml
      • user
        • 6142ffdc-a849-4424-a360-fe4fa5336545.yml

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 16

17 of 41

recipe.yml structure

  • name: 'Event'
    • type: 'Content type'
  • recipes:
    • event_manager
  • install:
    • datetime_range
    • node
  • config:
    • actions:
      • user.role.event_manager:
        • grantPermissions:
          • 'delete any event content'
          • 'edit any event content'

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 17

18 of 41

Config Actions API

A recipe can define a set of actions to apply to configuration that's provided either by an installed extension or by a recipe.

https://www.drupal.org/project/distributions_recipes/issues/3284025

KANOPI STUDIOS

A Tour of Drupal Tours | 18

19 of 41

Config Actions

Determine which core config entity methods should be config actions

https://www.drupal.org/project/distributions_recipes/issues/3303127

KANOPI STUDIOS

A Tour of Drupal Tours | 19

20 of 41

Where are Config Actions?

  • namespace Drupal\Core\Config\Action\Plugin\ConfigAction;
  • /core/lib/Drupal/Core/Config/Action/Plugin/ConfigAction/

Finding Config Actions

  • drush php-eval 'print_r(array_keys(\Drupal::service("plugin.manager.config_action")->getDefinitions()));'

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 20

21 of 41

What Config Actions exist?

  • simple_config_update : Updates Simple Configuration

What you can do with it:

actions:

node.settings:

simple_config_update:

use_admin_theme: true

user.settings:

simple_config_update:

register: admin_only

system.theme:

simple_config_update:

admin: 'gin'

default: 'stark'

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 21

22 of 41

What Config Actions exist?

  • ensure_exists: Used to conditionally create a config entity
  • entity_create: The create config action can be used to create a config entity. Like ensure_exists, create is not likely to be often useful in recipes.

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 22

23 of 41

What Config Actions exist?

  • entity_method: Makes config entity methods with the ActionMethod attribute into actions.
    • setFilterConfig(s)
    • grantPermission(s)

What you can do with it:

actions:

config.name

grantPermissions:

- 'delete any event content'

- 'edit any event content'

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 23

24 of 41

Proposed Config Actions

Determine which core config entity methods should be config actions

https://www.drupal.org/project/distributions_recipes/issues/3303127

KANOPI STUDIOS

A Tour of Drupal Tours | 24

25 of 41

Recipes are…

  • Applied to Drupal, not installed
  • Easy to share
  • Do not lock sites in
  • Composable from other recipes
  • Leave no trace

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 25

26 of 41

27 of 41

Recipe Generator

Add-on for Drush adds the capability to generate a Recipe for Drupal to help you build out your own Recipe with an interactive tool.

https://www.drupal.org/project/recipe_generator

KANOPI STUDIOS

A Tour of Drupal Tours | 27

28 of 41

Contributing to the Initiative

29 of 41

Drupal Slack

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 29

30 of 41

Important Documentation

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 30

31 of 41

Important Documentation

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 31

32 of 41

Important Documentation

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 32

33 of 41

Important Documentation

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 33

34 of 41

Important Documentation

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 34

35 of 41

Looking for co-maintainers / Additionals leads

Photo by Humberto Arellano

KANOPI STUDIOS

A Tour of Drupal Tours | 35

36 of 41

Roadmap

Photo by Jiachen Lin

KANOPI STUDIOS

A Tour of Drupal Tours | 36

37 of 41

Model core's standard install profile as recipes

KANOPI STUDIOS

A Tour of Drupal Tours | 37

38 of 41

Model core's Umami install profile as recipes

KANOPI STUDIOS

A Tour of Drupal Tours | 38

39 of 41

Configuration Validation work happening

KANOPI STUDIOS

A Tour of Drupal Tours | 39

40 of 41

Questions?

@thejimbirch

41 of 41

KANOPI STUDIOS

Thank you!

Reach out anytime.

jim@kanopi.com

@thejimbirch

jimbir.ch/drupal-recipes

Kanopi Studios - DrupalCon Pittsburgh 2023

Drupal Distributions & Recipes Initiative Update | 41