Skip to content

Commit

Permalink
fix: [open-y-subprojects#72] Implements a hook_update to add the defa…
Browse files Browse the repository at this point in the history
…ult language parameter to the location view.
  • Loading branch information
andrebonon committed May 7, 2024
1 parent 9851425 commit b8ff341
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
23 changes: 23 additions & 0 deletions modules/openy_map_lb/openy_map_lb.install
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,26 @@ function openy_map_lb_update_91001() {
}
}
}

/**
* Adds default language condition to the view location.
*/
function openy_map_lb_update_91002() {
$config_dir = \Drupal::service('extension.path.resolver')->getPath('module', 'openy_map_lb') . '/config/install/';
// Update multiple configurations.
$configs = [
'views.view.locations_lb' => [
'display.locations_block.display_options.filters.default_langcode',
'display.locations_block.display_options.arguments.rendering_language',
'display.locations_block.cache_metadata.contexts'
],
];

$config_updater = \Drupal::service('openy_upgrade_tool.param_updater');
foreach ($configs as $config_name => $params) {
$config = $config_dir . $config_name . '.yml';
foreach ($params as $param) {
$config_updater->update($config, $config_name, $param);
}
}
}
21 changes: 0 additions & 21 deletions openy_map.install
Original file line number Diff line number Diff line change
Expand Up @@ -154,24 +154,3 @@ function openy_map_update_8008() {
function openy_map_update_8009() {
_openy_map_absolutize_config_icon_urls();
}

/**
* Adds default language condition to the view location.
*/
function openy_map_update_8010() {
$config_dir = \Drupal::service('extension.path.resolver')->getPath('module', 'openy_map') . '/config/install/';
// Update multiple configurations.
$configs = [
'views.view.locations' => [
'required',
],
];

$config_updater = \Drupal::service('openy_upgrade_tool.param_updater');
foreach ($configs as $config_name => $params) {
$config = $config_dir . $config_name . '.yml';
foreach ($params as $param) {
$config_updater->update($config, $config_name, $param);
}
}
}

0 comments on commit b8ff341

Please sign in to comment.