Dispatch an event when a recipe is applied

Created on 16 April 2024, 5 months ago
Updated 30 April 2024, 4 months ago

Problem/Motivation

Right now, installed modules have no way to react when a recipe is applied. Such a thing would be a necessity for, say, Project Browser, so it can keep track of which recipes you've already applied and give you some kind of indication in its UI.

Proposed resolution

The recipe system should dispatch an event whenever a recipe is applied.

✨ Feature request
Status

Fixed

Version

10.3

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @phenaproxima
  • Merge request !108Add event with test coverage β†’ (Open) created by phenaproxima
  • Pipeline finished with Failed
    5 months ago
    Total: 224s
    #148234
  • Pipeline finished with Failed
    5 months ago
    Total: 410s
    #148238
  • Pipeline finished with Canceled
    5 months ago
    Total: 62s
    #148266
  • Pipeline finished with Failed
    5 months ago
    Total: 140s
    #148267
  • Pipeline finished with Success
    5 months ago
    Total: 419s
    #148272
  • Status changed to Needs review 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts
  • Status changed to RTBC 5 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Can we add a note to the recipes.api.php issue to document this?

  • Status changed to Fixed 5 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Committed and pushed 19dd1f33379 to 11.x and 72926a564fd to 10.3.x. Thanks!

    diff --git a/core/lib/Drupal/Core/Recipe/RecipeAppliedEvent.php b/core/lib/Drupal/Core/Recipe/RecipeAppliedEvent.php
    index cf2a94fb3b7..251139058cb 100644
    --- a/core/lib/Drupal/Core/Recipe/RecipeAppliedEvent.php
    +++ b/core/lib/Drupal/Core/Recipe/RecipeAppliedEvent.php
    @@ -10,7 +10,7 @@
      * Subscribers to this event should avoid modifying config or content, because
      * it is very likely that the recipe was applied as part of a chain of recipes,
      * so config and content are probably about to change again. This event is best
    - * used for tasks like clearing caches or updating a value in state.
    + * used for tasks like notifications, logging or updating a value in state.
      */
     final class RecipeAppliedEvent extends Event {
     
    

    Fixed on commit. Really hope no-one uses this for cache management.

    • alexpott β†’ committed 72926a56 on 10.3.x
      Issue #3441308 by phenaproxima: Dispatch an event when a recipe is...
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Cherry-picked to the core MR too.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024