Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
update hook update
Browse files Browse the repository at this point in the history
  • Loading branch information
yeniatencio committed Sep 2, 2024
1 parent 6ee3813 commit 619c737
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion modules/tide_site_theming/tide_site_theming.install
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function tide_site_theming_update_10001() {
'field.field.taxonomy_term.sites.field_short_name' => 'field_config',
'field.field.taxonomy_term.sites.field_site_app_icon' => 'field_config',
];
module_load_include('inc', 'tide_core', 'includes/helpers');
\Drupal::moduleHandler()->loadInclude('tide_core', 'inc', 'includes/helpers');
$config_location = [\Drupal::service('extension.list.module')->getPath('tide_site') . '/config/install'];
// Check if field already exported to config/sync.
foreach ($configs as $config => $type) {
Expand All @@ -238,4 +238,26 @@ function tide_site_theming_update_10001() {
$config_entity->save();
}
}

$form_configs = [
'core.entity_form_display.taxonomy_term.sites.default',
'core.entity_view_display.taxonomy_term.sites.default',
];
foreach ($form_configs as $form_config) {
$rewrite = _tide_read_config($form_config, $config_location, FALSE);
$display_config_entity = \Drupal::configFactory()->getEditable($form_config);
$original_config = $display_config_entity->getRawData();
$rewritten_config = NestedArray::mergeDeep($original_config, $rewrite);
if ($rewritten_config['dependencies']) {
$dependencies = $rewritten_config['dependencies'];
foreach ($dependencies as $type => $items) {
$uniqueItems = array_unique($items);
sort($uniqueItems);
$dependencies[$type] = $uniqueItems;
}
$rewritten_config['dependencies'] = $dependencies;
}
$display_config_entity->setData($rewritten_config);
$display_config_entity->save();
}
}

0 comments on commit 619c737

Please sign in to comment.