Skip to content

Commit

Permalink
Merge pull request #247 from localgovdrupal/2.x
Browse files Browse the repository at this point in the history
2.13.7 release
  • Loading branch information
finnlewis authored Sep 13, 2024
2 parents 9fc2c7d + af2d6c5 commit af46ae9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
5 changes: 4 additions & 1 deletion modules/localgov_admin_role/localgov_admin_role.install
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ use Drupal\user\Entity\Role;
/**
* Implements hook_install().
*/
function localgov_admin_role_install() {
function localgov_admin_role_install($is_syncing) {
if ($is_syncing) {
return;
}
// Check if the 'localgov_admin_role' role exists.
$admin_role = Role::load(RolesHelper::ADMIN_ROLE);
if (!$admin_role) {
Expand Down
8 changes: 7 additions & 1 deletion modules/localgov_roles/localgov_roles.install
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@
/**
* Implements hook_install().
*/
function localgov_roles_install() {
function localgov_roles_install($is_syncing) {

if ($is_syncing) {
return;
}

$roles = \Drupal::service('module_handler')->invokeAll('localgov_roles_default');
foreach ($roles as $role => $permissions) {
user_role_grant_permissions($role, $permissions);
}

}
7 changes: 4 additions & 3 deletions src/Service/DefaultBlockInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\Extension;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Extension\ThemeHandlerInterface;
use Drupal\Core\File\FileSystemInterface;
Expand Down Expand Up @@ -62,7 +63,7 @@ protected function targetThemes(): array {
$themes = ['localgov_base', 'localgov_scarfolk'];

$activeTheme = $this->getActiveThemeName();
if ($activeTheme && !in_array($activeTheme, $themes)) {
if ($activeTheme && !in_array($activeTheme, $themes, TRUE)) {
$themes[] = $activeTheme;
}

Expand Down Expand Up @@ -162,7 +163,7 @@ protected function sanitiseId(string $id): string {
* Does the given theme have the given region?
*/
protected function themeHasRegion(string $theme, string $region): bool {
return in_array($region, $this->themeRegions($theme));
return in_array($region, $this->themeRegions($theme), TRUE);
}

/**
Expand All @@ -171,7 +172,7 @@ protected function themeHasRegion(string $theme, string $region): bool {
protected function themeRegions(string $theme): array {
if (!isset($this->themeRegions[$theme])) {
$themeInfo = $this->themeHandler->getTheme($theme);
if (empty($themeInfo)) {
if (!$themeInfo instanceof Extension) {
$regions = [];
}
else {
Expand Down

0 comments on commit af46ae9

Please sign in to comment.