Skip to content

Commit

Permalink
cut over to asu_config.config_manager service
Browse files Browse the repository at this point in the history
  • Loading branch information
tbutterf committed Oct 22, 2024
1 parent 2d96bb7 commit e6d152b
Show file tree
Hide file tree
Showing 18 changed files with 190 additions and 180 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mono-package-split.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
# This app allows us to select all of the repositories we will be adding
# our access permissions to via the app-token. Just list them below
# in a comma separated string (without any spaces).
repositories: 'asu_user,asu_brand,asu_react_core,asu_react_integration'
repositories: 'asu_user,asu_brand,asu_react_core,asu_react_integration,asu_config_utility'

# The danharrin/monorepo-split-github-action below is the tool that we are using
# to sync the contents of the modules into their respective standalone,
Expand Down
4 changes: 2 additions & 2 deletions web/modules/asu_modules/asu_brand/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "drupal-module",
"license": "MIT",
"require": {
"asuwebplatforms/asu_react_core": "^1.0",
"asuwebplatforms/asu_react_integration": "^1.0"
"asuwebplatforms/asu_react_core": "dev-main",
"asuwebplatforms/asu_react_integration": "dev-main"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ description: Contains Utility Functionality
package: ASU
type: module
core_version_requirement: ^10
dependencies:
- drupal:config_update
5 changes: 4 additions & 1 deletion web/modules/asu_modules/asu_config_utility/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"name": "asuwebplatforms/asu_config_utility",
"description": "ASU Configuration Utility",
"type": "drupal-module",
"license": "MIT"
"license": "MIT",
"require": {
"drupal/config_update": "2.0.0-alpha3"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Drupal\webspark_utility;
namespace Drupal\asu_config_utility;

use Drupal\Core\Config\Entity\ConfigEntityType;
use Drupal\Core\Config\StorageInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Drupal\webspark_utility;
namespace Drupal\asu_config_utility;

use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderBase;
Expand Down
16 changes: 8 additions & 8 deletions web/modules/asu_modules/asu_degree_rfi/asu_degree_rfi.install
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function asu_degree_rfi_update_9002(&$sandbox) {
// Unlock the configuration storage.
\Drupal::state()->set('configuration_locked', FALSE);
// Revert all configs from this module.
\Drupal::service('webspark.config_manager')->revertAll($module);
\Drupal::service('asu_config.config_manager')->revertAll($module);
// Lock the configuration storage.
\Drupal::state()->set('configuration_locked', TRUE);
}
Expand All @@ -71,7 +71,7 @@ function asu_degree_rfi_update_9003(&$sandbox) {
// Unlock the configuration storage.
\Drupal::state()->set('configuration_locked', FALSE);
// Revert all configs from this module.
\Drupal::service('webspark.config_manager')->revertAll($module);
\Drupal::service('asu_config.config_manager')->revertAll($module);
// Lock the configuration storage.
\Drupal::state()->set('configuration_locked', TRUE);
}
Expand Down Expand Up @@ -144,7 +144,7 @@ function asu_degree_rfi_update_10001(&$sandbox) {
$config->save();

\Drupal::state()->set('configuration_locked', FALSE);
\Drupal::service('webspark.config_manager')->updateConfigFile('core.entity_view_display.node.degree_detail_page.default');
\Drupal::service('asu_config.config_manager')->updateConfigFile('core.entity_view_display.node.degree_detail_page.default');
\Drupal::state()->set('configuration_locked', TRUE);
}

Expand All @@ -153,10 +153,10 @@ function asu_degree_rfi_update_10001(&$sandbox) {
*/
function asu_degree_rfi_update_10002(&$sandbox) {
\Drupal::state()->set('configuration_locked', FALSE);
\Drupal::service('webspark.config_manager')->importConfigFile('field.field.node.degree_listing_page.field_degree_detail_breadcrumbs');
\Drupal::service('webspark.config_manager')->updateConfigFile('core.entity_form_display.node.degree_listing_page.default');
\Drupal::service('webspark.config_manager')->updateConfigFile('core.entity_view_display.node.degree_listing_page.teaser');
\Drupal::service('webspark.config_manager')->updateConfigFile('core.entity_view_display.node.degree_listing_page.default');
\Drupal::service('asu_config.config_manager')->importConfigFile('field.field.node.degree_listing_page.field_degree_detail_breadcrumbs');
\Drupal::service('asu_config.config_manager')->updateConfigFile('core.entity_form_display.node.degree_listing_page.default');
\Drupal::service('asu_config.config_manager')->updateConfigFile('core.entity_view_display.node.degree_listing_page.teaser');
\Drupal::service('asu_config.config_manager')->updateConfigFile('core.entity_view_display.node.degree_listing_page.default');
\Drupal::state()->set('configuration_locked', TRUE);
}

Expand All @@ -168,7 +168,7 @@ function _asu_degree_rfi_revert_all_module_config() {
// Unlock the configuration storage.
\Drupal::state()->set('configuration_locked', FALSE);
// Revert all configs from this module.
\Drupal::service('webspark.config_manager')->revertAll($module);
\Drupal::service('asu_config.config_manager')->revertAll($module);
// Lock the configuration storage.
\Drupal::state()->set('configuration_locked', TRUE);
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function asu_degree_rfi_config_readonly_whitelist_patterns() {
$module = \Drupal::service('module_handler')
->getModule(basename(__FILE__, '.module'))
->getName();
$configs = \Drupal::service('webspark.config_manager')->getModuleConfigFiles($module);
$configs = \Drupal::service('asu_config.config_manager')->getModuleConfigFiles($module);
$filtered_configs = [];
$filtered_configs = array_filter($configs, function ($v) {
// We want to allow the global config form for the module to be exempted
Expand Down
4 changes: 2 additions & 2 deletions web/modules/asu_modules/asu_events/asu_events.install
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function asu_events_update_9001(&$sandbox) {
// Unlock the configuration storage.
\Drupal::state()->set('configuration_locked', FALSE);
// Revert all configs from this module.
\Drupal::service('webspark.config_manager')->revertAll($module);
\Drupal::service('asu_config.config_manager')->revertAll($module);
// Lock the configuration storage.
\Drupal::state()->set('configuration_locked', TRUE);
}
Expand Down Expand Up @@ -41,7 +41,7 @@ function _asu_events_revert_all_module_config() {
// Unlock the configuration storage.
\Drupal::state()->set('configuration_locked', FALSE);
// Revert all configs from this module.
\Drupal::service('webspark.config_manager')->revertAll($module);
\Drupal::service('asu_config.config_manager')->revertAll($module);
// Lock the configuration storage.
\Drupal::state()->set('configuration_locked', TRUE);
}
2 changes: 1 addition & 1 deletion web/modules/asu_modules/asu_events/asu_events.module
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function asu_events_config_readonly_whitelist_patterns() {
$module = \Drupal::service('module_handler')
->getModule(basename(__FILE__, '.module'))
->getName();
$configs = \Drupal::service('webspark.config_manager')->getModuleConfigFiles($module);
$configs = \Drupal::service('asu_config.config_manager')->getModuleConfigFiles($module);
// Lock all the configurations from this module.
if (\Drupal::state()->get('configuration_locked', TRUE)) {
return array_map(function ($item) { return '~' . $item; }, $configs);
Expand Down
4 changes: 2 additions & 2 deletions web/modules/asu_modules/asu_news/asu_news.install
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function asu_news_update_9001(&$sandbox) {
// Unlock the configuration storage.
\Drupal::state()->set('configuration_locked', FALSE);
// Revert all configs from this module.
\Drupal::service('webspark.config_manager')->revertAll($module);
\Drupal::service('asu_config.config_manager')->revertAll($module);
// Lock the configuration storage.
\Drupal::state()->set('configuration_locked', TRUE);
}
Expand Down Expand Up @@ -49,7 +49,7 @@ function _asu_news_revert_all_module_config() {
// Unlock the configuration storage.
\Drupal::state()->set('configuration_locked', FALSE);
// Revert all configs from this module.
\Drupal::service('webspark.config_manager')->revertAll($module);
\Drupal::service('asu_config.config_manager')->revertAll($module);
// Lock the configuration storage.
\Drupal::state()->set('configuration_locked', TRUE);
}
2 changes: 1 addition & 1 deletion web/modules/asu_modules/asu_news/asu_news.module
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function asu_news_config_readonly_whitelist_patterns() {
$module = \Drupal::service('module_handler')
->getModule(basename(__FILE__, '.module'))
->getName();
$configs = \Drupal::service('webspark.config_manager')->getModuleConfigFiles($module);
$configs = \Drupal::service('asu_config.config_manager')->getModuleConfigFiles($module);
// Lock all the configurations from this module.
if (\Drupal::state()->get('configuration_locked', TRUE)) {
return array_map(function ($item) { return '~' . $item; }, $configs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "drupal-module",
"license": "MIT",
"require": {
"asuwebplatforms/asu_react_core": "^1.0"
"asuwebplatforms/asu_react_core": "dev-main"
}
}

5 changes: 4 additions & 1 deletion web/modules/asu_modules/asu_user/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"name": "asuwebplatforms/asu_user",
"description": "Contains drupal customisations for the asurite users.",
"type": "drupal-module",
"license": "MIT"
"license": "MIT",
"require": {
"asuwebplatforms/asu_config_utility": "dev-main"
}
}
32 changes: 16 additions & 16 deletions web/modules/webspark/webspark_blocks/webspark_blocks.install
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function webspark_blocks_update_9005(&$sandbox) {
// Unlock the configuration storage.
\Drupal::state()->set('configuration_locked', FALSE);
// Revert all configs from this module.
\Drupal::service('webspark.config_manager')->updateConfigFile('field.storage.block_content.field_background_color');
\Drupal::service('asu_config.config_manager')->updateConfigFile('field.storage.block_content.field_background_color');
// Lock the configuration storage.
\Drupal::state()->set('configuration_locked', TRUE);
}
Expand Down Expand Up @@ -99,7 +99,7 @@ function webspark_blocks_update_9012(&$sandbox) {

\Drupal::state()->set('configuration_locked', FALSE);
foreach ($yml_list as $yml) {
\Drupal::service('webspark.config_manager')->updateConfigFile($yml);
\Drupal::service('asu_config.config_manager')->updateConfigFile($yml);
}
\Drupal::state()->set('configuration_locked', TRUE);

Expand Down Expand Up @@ -170,7 +170,7 @@ function webspark_blocks_update_9019(&$sandbox) {
// Update the configs without using the revertAll() function,
// due to a change in where config files are stored. This also targets
// the configs to match the release in which this update was made.
$configs = \Drupal::service('webspark.config_manager')->getCsvConfigArray('webspark_blocks', '2.11.1_webspark_blocks_configs.csv');
$configs = \Drupal::service('asu_config.config_manager')->getCsvConfigArray('webspark_blocks', '2.11.1_webspark_blocks_configs.csv');
_webspark_blocks_update_module_config_list($configs);

if (!empty($accordions_to_update)) {
Expand All @@ -193,8 +193,8 @@ function webspark_blocks_update_9019(&$sandbox) {
*/
function webspark_blocks_update_9020(&$sandbox) {
\Drupal::state()->set('configuration_locked', FALSE);
\Drupal::service('webspark.config_manager')->updateConfigFile('field.storage.block_content.field_spacing_bottom');
\Drupal::service('webspark.config_manager')->updateConfigFile('field.storage.block_content.field_spacing_top');
\Drupal::service('asu_config.config_manager')->updateConfigFile('field.storage.block_content.field_spacing_bottom');
\Drupal::service('asu_config.config_manager')->updateConfigFile('field.storage.block_content.field_spacing_top');
\Drupal::state()->set('configuration_locked', TRUE);
}

Expand All @@ -203,16 +203,16 @@ function webspark_blocks_update_9020(&$sandbox) {
*/
function webspark_blocks_update_9021(&$sandbox) {
\Drupal::state()->set('configuration_locked', FALSE);
\Drupal::service('webspark.config_manager')->updateConfigFile('image.style.block_image_1_1_lge');
\Drupal::service('webspark.config_manager')->updateConfigFile('image.style.block_image_1_1_med');
\Drupal::service('webspark.config_manager')->updateConfigFile('image.style.block_image_1_1_sml');
\Drupal::service('webspark.config_manager')->updateConfigFile('image.style.block_image_16_9_lge');
\Drupal::service('webspark.config_manager')->updateConfigFile('image.style.block_image_16_9_med');
\Drupal::service('webspark.config_manager')->updateConfigFile('image.style.block_image_16_9_sml');
\Drupal::service('webspark.config_manager')->updateConfigFile('image.style.block_image_lge');
\Drupal::service('webspark.config_manager')->updateConfigFile('image.style.block_image_med');
\Drupal::service('webspark.config_manager')->updateConfigFile('image.style.block_image_sml');
\Drupal::service('webspark.config_manager')->updateConfigFile('image.style.video_poster_image');
\Drupal::service('asu_config.config_manager')->updateConfigFile('image.style.block_image_1_1_lge');
\Drupal::service('asu_config.config_manager')->updateConfigFile('image.style.block_image_1_1_med');
\Drupal::service('asu_config.config_manager')->updateConfigFile('image.style.block_image_1_1_sml');
\Drupal::service('asu_config.config_manager')->updateConfigFile('image.style.block_image_16_9_lge');
\Drupal::service('asu_config.config_manager')->updateConfigFile('image.style.block_image_16_9_med');
\Drupal::service('asu_config.config_manager')->updateConfigFile('image.style.block_image_16_9_sml');
\Drupal::service('asu_config.config_manager')->updateConfigFile('image.style.block_image_lge');
\Drupal::service('asu_config.config_manager')->updateConfigFile('image.style.block_image_med');
\Drupal::service('asu_config.config_manager')->updateConfigFile('image.style.block_image_sml');
\Drupal::service('asu_config.config_manager')->updateConfigFile('image.style.video_poster_image');
\Drupal::state()->set('configuration_locked', TRUE);
}

Expand Down Expand Up @@ -491,7 +491,7 @@ function webspark_blocks_update_10005(&$sandbox) {
function _webspark_blocks_update_module_config_list($config_list = []) {
\Drupal::state()->set('configuration_locked', FALSE);
foreach ($config_list as $config) {
\Drupal::service('webspark.config_manager')->updateConfigFile($config);
\Drupal::service('asu_config.config_manager')->updateConfigFile($config);
}
\Drupal::state()->set('configuration_locked', TRUE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function webspark_blocks_config_readonly_whitelist_patterns() {
$module = \Drupal::service('module_handler')
->getModule(basename(__FILE__, '.module'))
->getName();
$configs = \Drupal::service('webspark.config_manager')->getModuleConfigFiles($module);
$configs = \Drupal::service('asu_config.config_manager')->getModuleConfigFiles($module);
// Make fontawesome settings locked.
$configs[] = 'fontawesome.settings';
// Lock all the configurations from this module.
Expand Down
26 changes: 13 additions & 13 deletions web/modules/webspark/webspark_webdir/webspark_webdir.install
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function webspark_webdir_update_9010(&$sandbox): void
* Update the component_type description.
*/
function webspark_webdir_update_9012(&$sandbox): void {
\Drupal::service('webspark.config_manager')->updateConfigFile('field.field.block_content.web_directory.field_component_type');
\Drupal::service('asu_config.config_manager')->updateConfigFile('field.field.block_content.web_directory.field_component_type');
}

/**
Expand All @@ -257,18 +257,18 @@ function webspark_webdir_update_9012(&$sandbox): void {
* update see: https://docs.google.com/presentation/d/1MOOJNlFCBRsXXg4fBOL9YAUlP-x2W8TKIcWkMCdY11o/edit#slide=id.g110d8a6d565_3_0
*/
function webspark_webdir_update_9013(&$sandbox): void {
\Drupal::service('webspark.config_manager')->updateConfigFile('field.field.block_content.web_directory.field_component_type');
\Drupal::service('webspark.config_manager')->updateConfigFile('core.entity_form_display.block_content.web_directory.default');
\Drupal::service('webspark.config_manager')->updateConfigFile('core.entity_view_display.block_content.web_directory.default');
\Drupal::service('webspark.config_manager')->updateConfigFile('field.field.block_content.web_directory.field_webdir_disable_alpha');
\Drupal::service('webspark.config_manager')->updateConfigFile('field.storage.block_content.field_webdir_disable_alpha');
\Drupal::service('asu_config.config_manager')->updateConfigFile('field.field.block_content.web_directory.field_component_type');
\Drupal::service('asu_config.config_manager')->updateConfigFile('core.entity_form_display.block_content.web_directory.default');
\Drupal::service('asu_config.config_manager')->updateConfigFile('core.entity_view_display.block_content.web_directory.default');
\Drupal::service('asu_config.config_manager')->updateConfigFile('field.field.block_content.web_directory.field_webdir_disable_alpha');
\Drupal::service('asu_config.config_manager')->updateConfigFile('field.storage.block_content.field_webdir_disable_alpha');
}

/**
* Enable reordering of items in 'People' and 'People in Departments' listings.
*/
function webspark_webdir_update_9014(&$sandbox): void {
\Drupal::service('webspark.config_manager')->updateConfigFile('field.field.block_content.web_directory.field_asurite_ids');
\Drupal::service('asu_config.config_manager')->updateConfigFile('field.field.block_content.web_directory.field_asurite_ids');
}

/**
Expand All @@ -278,18 +278,18 @@ function webspark_webdir_update_9014(&$sandbox): void {
* like the field inside of it, so it's problematic. Just display the field.
*/
function webspark_webdir_update_9015(&$sandbox): void {
\Drupal::service('webspark.config_manager')->updateConfigFile('core.entity_form_display.block_content.web_directory.default');
\Drupal::service('asu_config.config_manager')->updateConfigFile('core.entity_form_display.block_content.web_directory.default');
}

/**
* WS2-1822 - Added Apparence settings for Web directory block.
*/
function webspark_webdir_update_9016(&$sandbox): void {
\Drupal::service('webspark.config_manager')->updateConfigFile('core.entity_form_display.block_content.web_directory.default');
\Drupal::service('webspark.config_manager')->updateConfigFile('core.entity_view_display.block_content.web_directory.default');
\Drupal::service('webspark.config_manager')->updateConfigFile('field.field.block_content.web_directory.field_anchor_menu_settings');
\Drupal::service('webspark.config_manager')->updateConfigFile('field.field.block_content.web_directory.field_spacing_bottom');
\Drupal::service('webspark.config_manager')->updateConfigFile('field.field.block_content.web_directory.field_spacing_top');
\Drupal::service('asu_config.config_manager')->updateConfigFile('core.entity_form_display.block_content.web_directory.default');
\Drupal::service('asu_config.config_manager')->updateConfigFile('core.entity_view_display.block_content.web_directory.default');
\Drupal::service('asu_config.config_manager')->updateConfigFile('field.field.block_content.web_directory.field_anchor_menu_settings');
\Drupal::service('asu_config.config_manager')->updateConfigFile('field.field.block_content.web_directory.field_spacing_bottom');
\Drupal::service('asu_config.config_manager')->updateConfigFile('field.field.block_content.web_directory.field_spacing_top');
}

// @todo This module doesn't implement hook_config_readonly_whitelist_patterns()
Expand Down
Loading

0 comments on commit e6d152b

Please sign in to comment.