Skip to content

Commit

Permalink
Rearranging update hook location since not all sites have the package…
Browse files Browse the repository at this point in the history
…2 module installed. Applying a more fine-grained update hook.
  • Loading branch information
thinkshout-ci-bot committed Jul 31, 2024
1 parent 9901f39 commit 3ac718b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 6 additions & 1 deletion modules/wri_admin/wri_admin.install
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* Update hooks for wri_admin module.
*/

use Drupal\user\Entity\Role;

/**
* Enable the modules better_passwords and rename_admin_paths and pulls config.
*/
Expand Down Expand Up @@ -32,9 +34,12 @@ function wri_admin_update_10001() {
/**
* Enable the module menu_admin_per_menu and pulls config.
*/
function wri_admin_update_10002() {
function wri_admin_update_10301() {
$moduleHandler = \Drupal::service('module_handler');
if (!$moduleHandler->moduleExists('menu_admin_per_menu')) {
\Drupal::service('module_installer')->install(['menu_admin_per_menu'], TRUE);
}
$role = Role::load('hr');
$role->grantPermission('administer page-hierarchies menu items');
$role->save();
}
7 changes: 0 additions & 7 deletions modules/wri_package2/wri_package2.install
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,3 @@ function _set_anonymous_authenticated_permissions() {
\Drupal::service('distro_helper.updates')->installConfig('user.role.editorial', 'wri_package2', 'post-install', TRUE);
\Drupal::service('distro_helper.updates')->installConfig('user.role.hr', 'wri_package2', 'post-install', TRUE);
}

/**
* Set updated HR permissions using menu_admin_per_menu.
*/
function wri_package2_update_10001() {
\Drupal::service('distro_helper.updates')->installConfig('user.role.hr', 'wri_package2', 'post-install', TRUE);
}

0 comments on commit 3ac718b

Please sign in to comment.