RecipeIsApplyingTestHooks.php

Same filename and directory in other branches
  1. 11.x core/modules/system/tests/modules/recipe_is_applying_test/src/Hook/RecipeIsApplyingTestHooks.php

Namespace

Drupal\recipe_is_applying_test\Hook

File

core/modules/system/tests/modules/recipe_is_applying_test/src/Hook/RecipeIsApplyingTestHooks.php

View source
<?php

declare (strict_types=1);
namespace Drupal\recipe_is_applying_test\Hook;

use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Hook\Attribute\Hook;
use Drupal\Core\KeyValueStore\KeyValueFactoryInterface;
use Drupal\Core\Recipe\RecipeRunner;

/**
 * Hook implementations for recipe_is_applying_test.
 */
class RecipeIsApplyingTestHooks {
  public function __construct(private KeyValueFactoryInterface $keyValueFactory) {
  }
  
  /**
   * Implements hook_modules_installed().
   */
  public function modulesInstalled(array $modules, bool $is_syncing) : void {
    $this->keyValueFactory
      ->get('recipe_is_applying_test')
      ->set('modules_installed', RecipeRunner::isApplying());
  }
  
  /**
   * Implements hook_themes_installed().
   */
  public function themesInstalled(array $theme_list) : void {
    $this->keyValueFactory
      ->get('recipe_is_applying_test')
      ->set('themes_installed', RecipeRunner::isApplying());
  }
  
  /**
   * Implements hook_ENTITY_TYPE_insert() for entity_test entities.
   */
  public function entityTestInsert(EntityInterface $entity) : void {
    $this->keyValueFactory
      ->get('recipe_is_applying_test')
      ->set('entity_test_insert', RecipeRunner::isApplying());
  }

}

Classes

Title Deprecated Summary
RecipeIsApplyingTestHooks Hook implementations for recipe_is_applying_test.

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