Skip to content

Commit

Permalink
Merge pull request danskernesdigitalebibliotek#1148 from danskernesdi…
Browse files Browse the repository at this point in the history
…gitalebibliotek/fix-opening-hours-update-hooks

Enable REST base dependency for opening hours in update hook
  • Loading branch information
kasperg authored May 14, 2024
2 parents 3c4dfcd + 7226405 commit bd4aa96
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion web/modules/custom/dpl_opening_hours/dpl_opening_hours.install
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

use Drupal\Core\Extension\ModuleInstallerInterface;
use Drupal\dpl_opening_hours\Mapping\OpeningHoursRepetitionType;
use Drupal\drupal_typed\DrupalTyped;
use function Safe\json_encode as json_encode;

/**
Expand Down Expand Up @@ -162,12 +164,26 @@ function dpl_opening_hours_update_10000(array &$sandbox): string {
}

/**
* Implements hook_update_N().
* Enable dpl_rest_base module.
*
* @param mixed[] $sandbox
* The update sandbox.
*/
function dpl_opening_hours_update_10001(array &$sandbox) : void {
$module_installer = DrupalTyped::service(ModuleInstallerInterface::class, 'module_installer');
// The dpl_rest_base module is a dependency containing classes that this
// module relies on. We need to have it enabled before other update hooks
// can run.
$module_installer->install(['dpl_rest_base']);
}

/**
* Update repetition field description.
*
* @param mixed[] $sandbox
* The update sandbox.
*/
function dpl_opening_hours_update_10002(array &$sandbox) : void {
$repetition_table = 'dpl_opening_hours_repetition';
$type_field = 'type';
$repetition_schema = dpl_opening_hours_schema()[$repetition_table];
Expand Down

0 comments on commit bd4aa96

Please sign in to comment.