Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/**
* @file
* Install, update and uninstall functions for the LocalGov Media Test Config module.
*/

use Drupal\Core\Recipe\Recipe;
use Drupal\Core\Recipe\RecipeRunner;

/**
* Implements hook_install().
*/
function localgov_media_test_config_install() {
// Apply the recipe to conditionally install media configuration.
// Only installs config that doesn't already exist (strict is false).
$module_path = \Drupal::service('extension.list.module')
->getPath('localgov_media_test_config');

$recipe_path = $module_path . '/recipe.yml';

// Check if recipe file exists before attempting to apply it.
if (file_exists($recipe_path)) {
$recipe = Recipe::createFromDirectory(dirname($recipe_path));
RecipeRunner::processRecipe($recipe);
}
}
18 changes: 18 additions & 0 deletions tests/localgov_media_test_config/recipe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'LocalGov Media Test Configuration'
description: 'Provides media configuration for testing, only installing config that is not already present'

install:
- drupal:ckeditor5
- drupal:editor
- drupal:media_library
- drupal:media_library_edit
- drupal:responsive_image
- entity_usage:entity_usage
- image_widget_crop:image_widget_crop
- linkit:linkit
- paragraphs:paragraphs_library

config:
import:
'./config/recipe': '*'
strict: false
Loading