function RecipeRunner::triggerEvent

Same name in other branches
  1. 10 core/lib/Drupal/Core/Recipe/RecipeRunner.php \Drupal\Core\Recipe\RecipeRunner::triggerEvent()

Triggers the RecipeAppliedEvent.

Parameters

\Drupal\Core\Recipe\Recipe $recipe: The recipe to apply.

array<mixed>|null $context: The batch context if called by a batch.

1 call to RecipeRunner::triggerEvent()
RecipeRunner::processRecipe in core/lib/Drupal/Core/Recipe/RecipeRunner.php

File

core/lib/Drupal/Core/Recipe/RecipeRunner.php, line 50

Class

RecipeRunner
Applies a recipe.

Namespace

Drupal\Core\Recipe

Code

public static function triggerEvent(Recipe $recipe, ?array &$context = NULL) : void {
    $event = new RecipeAppliedEvent($recipe);
    \Drupal::service(EventDispatcherInterface::class)->dispatch($event);
    $context['message'] = t('Applied %recipe recipe.', [
        '%recipe' => $recipe->name,
    ]);
    $context['results']['recipe'][] = $recipe->name;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.