Skip to content

Commit

Permalink
Update hook
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Jan 5, 2024
1 parent 5f5c891 commit 623043e
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
uuid: 5b3230ab-504b-4e91-9973-1160bb7ee41f
langcode: en
status: true
dependencies:
config:
- build_hooks.frontend_environment.sul_public
id: build_hooks_deployment.sul_public.default
targetEntityType: build_hooks_deployment
bundle: sul_public
mode: default
content: { }
hidden:
changed: true
contents: true
created: true
deleted: true
deployed: true
label: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
uuid: 5f3f7680-fc8b-4fc3-92f4-933de5b67c45
langcode: en
status: true
dependencies:
config:
- build_hooks.frontend_environment.sul_public
module:
- dynamic_entity_reference
id: build_hooks_deployment.sul_public.default
targetEntityType: build_hooks_deployment
bundle: sul_public
mode: default
content:
contents:
type: dynamic_entity_reference_label
label: above
settings:
link: true
third_party_settings: { }
weight: 20
region: content
deleted:
type: string
label: above
settings:
link_to_entity: false
third_party_settings: { }
weight: 20
region: content
label:
type: string
label: hidden
settings:
link_to_entity: false
third_party_settings: { }
weight: -5
region: content
hidden:
changed: true
created: true
deployed: true
search_api_excerpt: true
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,37 @@ function sul_helper_update_8001() {
function sul_helper_update_8002() {
\Drupal::state()->set('stanford_profile_helper.decoupled', TRUE);
}

/**
* Update configs 'stanford_profile_admin' with 'stanford_profile_admin_theme'.
*/
function sul_helper_update_8003() {
$config_factory = \Drupal::configFactory();
foreach ($config_factory->listAll() as $config_name) {
$config = $config_factory->getEditable($config_name);
// Delete the admin theme blocks first.
if (str_starts_with($config_name, 'block.block.stanford_profile_admin_')) {
$config->delete();
continue;
}

// Change the dependencies to the new theme name.
if ($theme_dependencies = $config->get('dependencies.theme')) {
$position = array_search('stanford_profile_admin', $theme_dependencies);
if ($position !== FALSE) {
$config->set("dependencies.theme.$position", 'stanford_profile_admin_theme')
->save(TRUE);
}
}
}

$core_extension = $config_factory->getEditable('core.extension');
$core_extension->clear('theme.stanford_profile_admin')
->set('theme.stanford_profile_admin_theme', 0)
->save();

$system_theme = $config_factory->getEditable('system.theme');
$system_theme->set('admin', 'stanford_profile_admin_theme')
->set('default', 'stanford_profile_admin_theme')
->save();
}

0 comments on commit 623043e

Please sign in to comment.