Skip to content

Commit

Permalink
Merge pull request #458 from localgovdrupal/4.x
Browse files Browse the repository at this point in the history
4.0.0-beta2 release
  • Loading branch information
finnlewis authored Jun 18, 2024
2 parents 6549c52 + b6b78d7 commit 4a7cd26
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"drupal/gin_login": "^2.0",
"drupal/gin_toolbar": "^1.0@RC",
"drupal/metatag": "^1.22",
"drupal/redirect": "^1.9",
"localgovdrupal/localgov_blogs": "^1.0.0-beta3",
"localgovdrupal/localgov_core": "^2.12",
"localgovdrupal/localgov_directories": "^3.0@alpha",
Expand Down
1 change: 1 addition & 0 deletions localgov_microsites.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ install:
- metatag:metatag_open_graph
- metatag:metatag_twitter_cards
- require_login:require_login
- redirect:redirect
- twig_tweak:twig_tweak

# LocalGov Drupal
Expand Down
44 changes: 43 additions & 1 deletion localgov_microsites.install
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,54 @@
* Install functions for the LocalGov Microsites installation profile.
*/

use Drupal\user\Entity\Role;

/**
* Implements hook_install().
*/
function localgov_microsites_install() {
// Allow microsites controllers and editors to use redirect module.
$role_names = [
'microsites_controller',
'microsites_trusted_editor',
];

// Set 'administer redirects' permission for controllers and editors.
foreach ($role_names as $role_name) {
$role = Role::load($role_name);
$role->grantPermission('administer redirects');
$role->save();
}
}

/**
* Enable stable9 theme if localgov_base theme is enabled.
*/
function localgov_update_9501() {

if (\Drupal::service('theme_handler')->themeExists('localgov_base')) {
\Drupal::service('theme_installer')->install(['stable9']);
}
}

/**
* Enable redirect module and set 'administer redirects' permission.
*/
function localgov_microsites_update_10001() {
// Enable redirect module if it is not already enabled.
$moduleHandler = \Drupal::service('module_handler');
if (!$moduleHandler->moduleExists('redirect')) {
\Drupal::service('module_installer')->install(['redirect']);
}

// Set 'administer redirects' permission for controllers and editors.
$role_names = [
'microsites_controller',
'microsites_trusted_editor',
];

foreach ($role_names as $role_name) {
$role = Role::load($role_name);
$role->grantPermission('administer redirects');
$role->save();
}
}

0 comments on commit 4a7cd26

Please sign in to comment.