diff --git a/composer.lock b/composer.lock index 11c249435..a06a46bf4 100644 --- a/composer.lock +++ b/composer.lock @@ -2390,7 +2390,7 @@ "dist": { "type": "path", "url": "./modules/acquia_cms_common", - "reference": "b2fe6b5717ef5c06a9a978b712bb12252d309a4f" + "reference": "36ebfe06447b4f28301a18995d197336fb6ce1f3" }, "require": { "acquia/drupal-environment-detector": "^1.5", @@ -2921,10 +2921,9 @@ "dist": { "type": "path", "url": "./modules/acquia_cms_toolbar", - "reference": "0cc6f26997c253705d6d7087a8878f7e690a29a0" + "reference": "315a0a579401ca9fbffbfe82828772d7771000b5" }, "require": { - "drupal/acquia_cms_common": "^1.9 || ^2.1 || ^3.1", "drupal/admin_toolbar": "^3.3" }, "conflict": { @@ -2950,14 +2949,14 @@ "dist": { "type": "path", "url": "./modules/acquia_cms_tour", - "reference": "04e968e9b96a2b1fb974296aee91951ec849f6b9" + "reference": "63b34fbe25350ae4caed0d0232b3de2dff6f400f" }, "require": { - "drupal/acquia_cms_common": "^1.9 || ^2.1 || ^3.1", "drupal/checklistapi": "^2.1" }, "require-dev": { - "drupal/acquia_cms_place": "^1", + "drupal/geocoder": "^3.35 || ^4.10", + "drupal/google_tag": "^2", "drupal/recaptcha": "^3" }, "type": "drupal-module", diff --git a/modules/acquia_cms_toolbar/acquia_cms_toolbar.install b/modules/acquia_cms_toolbar/acquia_cms_toolbar.install index e00481b75..2490ee368 100644 --- a/modules/acquia_cms_toolbar/acquia_cms_toolbar.install +++ b/modules/acquia_cms_toolbar/acquia_cms_toolbar.install @@ -7,6 +7,27 @@ use Drupal\user\Entity\Role; +/** + * Implements hook_install(). + */ +function acquia_cms_toolbar_install($is_syncing) { + if (!$is_syncing) { + $roles = Role::loadMultiple(); + foreach ($roles as $role) { + switch ($role->id()) { + case 'content_administrator': + case 'content_author': + case 'content_editor': + case 'developer': + case 'site_builder': + case 'user_administrator': + user_role_grant_permissions($role->id(), ['access toolbar']); + break; + } + } + } +} + /** * Update role permission handler. */ diff --git a/modules/acquia_cms_toolbar/acquia_cms_toolbar.module b/modules/acquia_cms_toolbar/acquia_cms_toolbar.module index 391ce70da..c57335f43 100644 --- a/modules/acquia_cms_toolbar/acquia_cms_toolbar.module +++ b/modules/acquia_cms_toolbar/acquia_cms_toolbar.module @@ -6,8 +6,8 @@ */ use Acquia\DrupalEnvironmentDetector\AcquiaDrupalEnvironmentDetector as Environment; +use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Url; -use Drupal\user\RoleInterface; /** * Implements hook_preprocess_HOOK(). @@ -102,17 +102,17 @@ function _acquia_cms_toolbar_get_environment_indicator_color_config(): array { } /** - * Implements hook_content_model_role_presave_alter(). + * Implements hook_entity_insert(). */ -function acquia_cms_toolbar_content_model_role_presave_alter(RoleInterface &$role) { - switch ($role->id()) { +function acquia_cms_toolbar_entity_insert(EntityInterface $entity) { + switch ($entity->id()) { case 'content_administrator': case 'content_author': case 'content_editor': case 'developer': case 'site_builder': case 'user_administrator': - $role->grantPermission('access toolbar'); + user_role_grant_permissions($entity->id(), ['access toolbar']); break; } } diff --git a/modules/acquia_cms_toolbar/composer.json b/modules/acquia_cms_toolbar/composer.json index 9540e671d..2974c3d37 100644 --- a/modules/acquia_cms_toolbar/composer.json +++ b/modules/acquia_cms_toolbar/composer.json @@ -4,7 +4,6 @@ "license": "GPL-2.0-or-later", "type": "drupal-module", "require": { - "drupal/acquia_cms_common": "^1.9 || ^2.1 || ^3.1", "drupal/admin_toolbar": "^3.3" }, "conflict": { diff --git a/modules/acquia_cms_tour/acquia_cms_tour.info.yml b/modules/acquia_cms_tour/acquia_cms_tour.info.yml index e7e199b20..90af15d5d 100644 --- a/modules/acquia_cms_tour/acquia_cms_tour.info.yml +++ b/modules/acquia_cms_tour/acquia_cms_tour.info.yml @@ -3,5 +3,3 @@ package: "Acquia CMS" description: "Provides a tour page for Acquia CMS." type: module core_version_requirement: ^9.4 || ^10 || ^11 -dependencies: - - acquia_cms_common:acquia_cms_common diff --git a/modules/acquia_cms_tour/acquia_cms_tour.install b/modules/acquia_cms_tour/acquia_cms_tour.install index 875a9b526..c9c35aa76 100644 --- a/modules/acquia_cms_tour/acquia_cms_tour.install +++ b/modules/acquia_cms_tour/acquia_cms_tour.install @@ -7,6 +7,18 @@ use Drupal\user\Entity\Role; +/** + * Implements hook_install(). + */ +function acquia_cms_tour_install($is_syncing) { + if (!$is_syncing) { + $role = Role::load('content_administrator'); + if ($role) { + user_role_grant_permissions('content_administrator', ['access acquia cms tour dashboard']); + } + } +} + /** * Add state key for existing sites with Acquia CMS profile. */ diff --git a/modules/acquia_cms_tour/acquia_cms_tour.module b/modules/acquia_cms_tour/acquia_cms_tour.module index 3cd399189..fd0b8b611 100644 --- a/modules/acquia_cms_tour/acquia_cms_tour.module +++ b/modules/acquia_cms_tour/acquia_cms_tour.module @@ -5,7 +5,7 @@ * Contains hook implementations for the acquia_cms_tour module. */ -use Drupal\user\RoleInterface; +use Drupal\Core\Entity\EntityInterface; /** * Implements hook_menu_links_discovered_alter(). @@ -57,12 +57,12 @@ function acquia_cms_tour_modules_uninstalled(array $modules) { } /** - * Implements hook_content_model_role_presave_alter(). + * Implements hook_cms_tour_entity_insert(). */ -function acquia_cms_tour_content_model_role_presave_alter(RoleInterface &$role) { - switch ($role->id()) { +function acquia_cms_tour_entity_insert(EntityInterface $entity) { + switch ($entity->id()) { case 'content_administrator': - $role->grantPermission('access acquia cms tour dashboard'); + user_role_grant_permissions('content_administrator', ['access acquia cms tour dashboard']); break; } } diff --git a/modules/acquia_cms_tour/composer.json b/modules/acquia_cms_tour/composer.json index ca400c78d..44c209835 100644 --- a/modules/acquia_cms_tour/composer.json +++ b/modules/acquia_cms_tour/composer.json @@ -4,11 +4,11 @@ "license": "GPL-2.0-or-later", "type": "drupal-module", "require": { - "drupal/acquia_cms_common": "^1.9 || ^2.1 || ^3.1", "drupal/checklistapi": "^2.1" }, "require-dev": { - "drupal/acquia_cms_place": "^1", + "drupal/geocoder": "^3.35 || ^4.10", + "drupal/google_tag": "^2", "drupal/recaptcha": "^3" }, "config": { diff --git a/modules/acquia_cms_tour/css/acquia_cms_tour_dashboard.css b/modules/acquia_cms_tour/css/acquia_cms_tour_dashboard.css index 3b4a75b22..f00ed69ef 100644 --- a/modules/acquia_cms_tour/css/acquia_cms_tour_dashboard.css +++ b/modules/acquia_cms_tour/css/acquia_cms_tour_dashboard.css @@ -78,7 +78,7 @@ padding: 0; margin: 0; } -.acms-dashboard-form-wrapper .js-form-wrapper .js-form-wrapper .fieldset__wrapper{ +.acms-dashboard-form-wrapper .js-form-wrapper .js-form-wrapper .fieldset__wrapper { margin-left: 0; } .section-top { diff --git a/modules/acquia_cms_tour/src/Controller/DashboardController.php b/modules/acquia_cms_tour/src/Controller/DashboardController.php index cb68b3e61..3c378b9ce 100644 --- a/modules/acquia_cms_tour/src/Controller/DashboardController.php +++ b/modules/acquia_cms_tour/src/Controller/DashboardController.php @@ -2,13 +2,13 @@ namespace Drupal\acquia_cms_tour\Controller; -use Drupal\acquia_cms_tour\AcquiaCmsTourManager; -use Drupal\acquia_cms_tour\Services\StarterKitService; use Drupal\Component\Serialization\Json; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\DependencyInjection\ClassResolverInterface; use Drupal\Core\State\StateInterface; use Drupal\Core\Url; +use Drupal\acquia_cms_tour\AcquiaCmsTourManager; +use Drupal\acquia_cms_tour\Services\StarterKitService; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RequestStack; diff --git a/modules/acquia_cms_tour/src/Form/InstallationWizardForm.php b/modules/acquia_cms_tour/src/Form/InstallationWizardForm.php index 97047157f..270e259f0 100644 --- a/modules/acquia_cms_tour/src/Form/InstallationWizardForm.php +++ b/modules/acquia_cms_tour/src/Form/InstallationWizardForm.php @@ -2,13 +2,13 @@ namespace Drupal\acquia_cms_tour\Form; -use Drupal\acquia_cms_tour\AcquiaCmsTourManager; use Drupal\Core\DependencyInjection\ClassResolverInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element; use Drupal\Core\Render\Renderer; use Drupal\Core\State\StateInterface; +use Drupal\acquia_cms_tour\AcquiaCmsTourManager; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/modules/acquia_cms_tour/src/Form/StarterKitSelectionWizardForm.php b/modules/acquia_cms_tour/src/Form/StarterKitSelectionWizardForm.php index f2dfe1ac3..68000d21f 100644 --- a/modules/acquia_cms_tour/src/Form/StarterKitSelectionWizardForm.php +++ b/modules/acquia_cms_tour/src/Form/StarterKitSelectionWizardForm.php @@ -2,13 +2,13 @@ namespace Drupal\acquia_cms_tour\Form; -use Drupal\acquia_cms_tour\AcquiaCmsStarterKitManager; use Drupal\Core\DependencyInjection\ClassResolverInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element; use Drupal\Core\Render\Renderer; use Drupal\Core\State\StateInterface; +use Drupal\acquia_cms_tour\AcquiaCmsStarterKitManager; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsStarterKit/StarterKitConfigForm.php b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsStarterKit/StarterKitConfigForm.php index e8b784098..fac24c484 100644 --- a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsStarterKit/StarterKitConfigForm.php +++ b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsStarterKit/StarterKitConfigForm.php @@ -2,9 +2,9 @@ namespace Drupal\acquia_cms_tour\Plugin\AcquiaCmsStarterKit; -use Drupal\acquia_cms_tour\Form\AcquiaCmsStarterKitBase; use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Form\FormStateInterface; +use Drupal\acquia_cms_tour\Form\AcquiaCmsStarterKitBase; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsStarterKit/StarterKitSelectionForm.php b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsStarterKit/StarterKitSelectionForm.php index bac080e73..cd5cba434 100644 --- a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsStarterKit/StarterKitSelectionForm.php +++ b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsStarterKit/StarterKitSelectionForm.php @@ -2,9 +2,9 @@ namespace Drupal\acquia_cms_tour\Plugin\AcquiaCmsStarterKit; -use Drupal\acquia_cms_tour\Form\AcquiaCmsStarterKitBase; use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Form\FormStateInterface; +use Drupal\acquia_cms_tour\Form\AcquiaCmsStarterKitBase; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleMapsApiForm.php b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleMapsApiForm.php index 64425e91a..10eabf23d 100644 --- a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleMapsApiForm.php +++ b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleMapsApiForm.php @@ -2,9 +2,9 @@ namespace Drupal\acquia_cms_tour\Plugin\AcquiaCmsTour; -use Drupal\acquia_cms_tour\Form\AcquiaCmsDashboardBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; +use Drupal\acquia_cms_tour\Form\AcquiaCmsDashboardBase; use Drupal\geocoder\GeocoderProviderInterface; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php index e713f4f0d..15b71fe87 100644 --- a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php +++ b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/GoogleTagManagerForm.php @@ -2,10 +2,10 @@ namespace Drupal\acquia_cms_tour\Plugin\AcquiaCmsTour; -use Drupal\acquia_cms_tour\Form\AcquiaCmsDashboardBase; use Drupal\Component\Utility\Html; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; +use Drupal\acquia_cms_tour\Form\AcquiaCmsDashboardBase; use Drupal\google_tag\Entity\TagContainer; /** @@ -92,7 +92,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { if ($accounts === []) { $config_name = 'google_tag.container.' . $account_default_value; $entity_accounts = $this->config($config_name)->get('tag_container_ids'); - if ($entity_accounts){ + if ($entity_accounts) { foreach ($entity_accounts as $index => $account) { $accounts[$index]['value'] = $account; $accounts[$index]['weight'] = $index; @@ -242,7 +242,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $config->set('tag_container_ids', array_values($tag_container_ids)); $config->save(); } - if($this->configFactory->getEditable('google_tag.settings')->get('default_google_tag_entity') !== NULL) { + if ($this->configFactory->getEditable('google_tag.settings')->get('default_google_tag_entity') !== NULL) { $this->configFactory->getEditable('google_tag.settings')->set('default_google_tag_entity', $config_id)->save(); } diff --git a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/RecaptchaForm.php b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/RecaptchaForm.php index 9ec748527..136774231 100644 --- a/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/RecaptchaForm.php +++ b/modules/acquia_cms_tour/src/Plugin/AcquiaCmsTour/RecaptchaForm.php @@ -2,9 +2,9 @@ namespace Drupal\acquia_cms_tour\Plugin\AcquiaCmsTour; -use Drupal\acquia_cms_tour\Form\AcquiaCmsDashboardBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; +use Drupal\acquia_cms_tour\Form\AcquiaCmsDashboardBase; /** * Plugin implementation of the acquia_cms_tour. diff --git a/modules/acquia_cms_tour/src/Services/StarterKitService.php b/modules/acquia_cms_tour/src/Services/StarterKitService.php index a9bc889f1..ce3402ad7 100644 --- a/modules/acquia_cms_tour/src/Services/StarterKitService.php +++ b/modules/acquia_cms_tour/src/Services/StarterKitService.php @@ -77,7 +77,7 @@ public function __construct( * @param string $content_model * Variable holding the content model option selected. */ - public function enableModules(string $starter_kit, string $demo_question = NULL, string $content_model = NULL) { + public function enableModules(string $starter_kit, ?string $demo_question = NULL, ?string $content_model = NULL) { $starter_kits = [ 'acquia_cms_enterprise_low_code' => 'Acquia CMS Enterprise low-code', 'acquia_cms_community' => 'Acquia CMS Community', @@ -144,7 +144,7 @@ public static function enableSingleModule(string $module) { * @param string $content_model * Variable holding the content model option selected. */ - public function getModulesAndThemes(string $starter_kit, string $demo_question = NULL, string $content_model = NULL) { + public function getModulesAndThemes(string $starter_kit, ?string $demo_question = NULL, ?string $content_model = NULL) { $enableModules = $enableThemes = []; switch ($starter_kit) { case 'acquia_cms_enterprise_low_code': @@ -227,7 +227,7 @@ public function getModulesAndThemes(string $starter_kit, string $demo_question = * @param string $content_model * Variable holding the content model option selected. */ - public function getMissingModules(string $starter_kit, string $demo_question = NULL, string $content_model = NULL) { + public function getMissingModules(string $starter_kit, ?string $demo_question = NULL, ?string $content_model = NULL) { $modulesAndThemes = $this->getModulesAndThemes($starter_kit, $demo_question, $content_model); $modules = $modulesAndThemes['enableModules']; $moduleList = array_keys($this->moduleExtensionList->getList()); diff --git a/modules/acquia_cms_tour/tests/src/Functional/AcquiaGoogleMapsTest.php b/modules/acquia_cms_tour/tests/src/Functional/AcquiaGoogleMapsTest.php index f4eadac42..431acd8ca 100644 --- a/modules/acquia_cms_tour/tests/src/Functional/AcquiaGoogleMapsTest.php +++ b/modules/acquia_cms_tour/tests/src/Functional/AcquiaGoogleMapsTest.php @@ -2,8 +2,8 @@ namespace Drupal\Tests\acquia_cms_tour\Functional; -use Drupal\geocoder\Entity\GeocoderProvider; use Drupal\Tests\BrowserTestBase; +use Drupal\geocoder\Entity\GeocoderProvider; /** * Tests the Acquia CMS Tour module's integration with Google Maps. @@ -24,7 +24,7 @@ class AcquiaGoogleMapsTest extends BrowserTestBase { */ protected static $modules = [ 'acquia_cms_tour', - 'acquia_cms_place', + 'geocoder', ]; /**