Skip to content

Commit

Permalink
Merge pull request #1675 from acquia/ACMS-1990-1
Browse files Browse the repository at this point in the history
ACMS-1990: Acquia CMS Toolbar changes as per Acquia CMS Gin theme.
  • Loading branch information
vishalkhode1 authored Dec 6, 2023
2 parents 9c80169 + b4aa006 commit b047e1c
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 683 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"drupal/acquia_cms_toolbar": "dev-develop",
"drupal/acquia_cms_tour": "dev-develop",
"drupal/consumer_image_styles": "^4.0",
"drupal/gin": "^3.0",
"drupal/google_analytics": "^4.0",
"drupal/google_tag": "^2.0",
"drupal/honeypot": "^2.1",
Expand Down
10 changes: 6 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 15 additions & 25 deletions modules/acquia_cms_common/acquia_cms_common.install
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ use Drupal\workbench_email\Entity\Template;
* Implements hook_install().
*/
function acquia_cms_common_install($is_syncing) {
$module_handler = \Drupal::moduleHandler();
if (!$is_syncing) {
$module_handler = \Drupal::moduleHandler();
$module_installer = \Drupal::service('module_installer');
_acquia_cms_common_import_configurations();
user_role_grant_permissions('anonymous', [
'access content',
Expand All @@ -27,12 +28,21 @@ function acquia_cms_common_install($is_syncing) {
'view media',
]);

// Enable olivero, gin theme.
$theme_installer = \Drupal::service('theme_installer');
$theme_installer->install(["olivero", "gin"]);
// Get all available themes.
$themes_list = \Drupal::service('extension.list.theme')->getList();
$themes_install = ["olivero"];
if (isset($themes_list['gin'])) {
$themes_install[] = "gin";
}
// Enable themes.
\Drupal::service('theme_installer')->install($themes_install);
$system_theme_config = \Drupal::configFactory()->getEditable('system.theme');
$system_theme_config->set('default', 'olivero')->save();
$system_theme_config->set('admin', "gin")->save();
if (in_array("gin", $themes_install)) {
$system_theme_config->set('admin', "gin")->save();
// Enable gin_toolbar module.
$module_installer->install(['gin_toolbar']);
}

// Re-write the content and media view on module install,
// since we have moved this config in optional directory.
Expand All @@ -56,7 +66,6 @@ function acquia_cms_common_install($is_syncing) {
$config->set('enable_export_filtering', TRUE);
$config->save(TRUE);

$module_installer = \Drupal::service('module_installer');
if ($module_handler->moduleExists('page_cache')) {
// Uninstall page_cache module in favour of memcache.
$module_installer->uninstall(['page_cache']);
Expand Down Expand Up @@ -299,22 +308,3 @@ function acquia_cms_common_update_8009() {
}
}
}

/**
* Implements hook_update_N().
*
* Enable Gin and set as admin theme is current admin theme is Acquia Claro.
*/
function acquia_cms_common_update_8301() {
$config = \Drupal::configFactory()->getEditable('system.theme');
if ($config) {
if ($config->get('admin') == 'acquia_claro') {
$themes_list = \Drupal::service('extension.list.theme')->getList();
$theme_installer = \Drupal::service('theme_installer');
if (isset($themes_list['gin'])) {
$theme_installer->install(["gin"]);
$config->set('admin', "gin")->save();
}
}
}
}
1 change: 0 additions & 1 deletion modules/acquia_cms_common/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"drupal/diff": "^1.1",
"drupal/entity_clone": "^2.0@beta",
"drupal/field_group": "^3.4",
"drupal/gin": "^3.0@RC",
"drupal/memcache": "^2.5",
"drupal/moderation_dashboard": "^2.1",
"drupal/moderation_sidebar": "^1.7",
Expand Down
3 changes: 3 additions & 0 deletions modules/acquia_cms_toolbar/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"drupal/acquia_cms_common": "1.x-dev || 2.x-dev || 3.x-dev",
"drupal/admin_toolbar": "^3.3"
},
"conflict": {
"drupal/acquia_claro": "<1.4"
},
"config": {
"allow-plugins": {
"composer/installers": true,
Expand Down
Loading

0 comments on commit b047e1c

Please sign in to comment.