Skip to content

Commit

Permalink
Merge pull request #724 from localgovdrupal/3.x
Browse files Browse the repository at this point in the history
3.0.6 release
  • Loading branch information
finnlewis authored May 28, 2024
2 parents f8d64ef + b474d8e commit d2ce34c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
7 changes: 7 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"drupal/gin_toolbar": "^1.0@beta",
"drupal/entity_browser": "^2.9",
"drupal/preview_link": "^2.1@alpha",
"drupal/redirect": "^1.6",
"drupal/simple_sitemap": "^4.1",
"drupal/search_api": "^1.21",
"drush/drush": ">=10",
Expand Down Expand Up @@ -59,6 +60,12 @@
"patches": {
"drupal/core": {
"Users can't reference unpublished content even when they have access to it. See https://www.drupal.org/project/drupal/issues/2845144": "https://www.drupal.org/files/issues/2024-02-13/2845144-87.patch"
},
"drupal/preview_link": {
"Add a 'copy to clipboard' feature for preview_link": "https://www.drupal.org/files/issues/2024-05-28/3449121-9.patch"
},
"drupal/redirect": {
"Validation issue on adding url redirect: https://www.drupal.org/project/redirect/issues/3057250": "https://www.drupal.org/files/issues/2022-09-01/3057250-53.patch"
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions localgov.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ install:
- gin_login:gin_login
- gin_toolbar:gin_toolbar
- preview_link:preview_link
- redirect:redirect
- redirect:redirect_404
- simple_sitemap:simple_sitemap
# LocalGov Drupal
- localgov:localgov_login_redirect
Expand Down
32 changes: 28 additions & 4 deletions localgov.install
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use Drupal\views\Entity\View;
*/
function localgov_install() {

$config_factory = \Drupal::configFactory();

// Assign user 1 the "administrator" role.
$user = User::load(1);
$user->roles[] = 'administrator';
Expand All @@ -28,11 +30,17 @@ function localgov_install() {

// Set front page to /user.
// This is so there is a default accessible front page on first install.
\Drupal::configFactory()
->getEditable('system.site')
->set('page.front', '/user')
->save();
$system_site_config = $config_factory->getEditable('system.site');
$system_site_config->set('page.front', '/user')->save();

// Enable entity_usage for media by default.
$entity_usage_config = $config_factory->getEditable('entity_usage.settings');
$local_task_enabled_entity_types = $entity_usage_config->get('local_task_enabled_entity_types');
if (!in_array('media', $local_task_enabled_entity_types)) {
$local_task_enabled_entity_types[] = 'media';
$entity_usage_config->set('local_task_enabled_entity_types', $local_task_enabled_entity_types);
$entity_usage_config->save(TRUE);
}
}

/**
Expand Down Expand Up @@ -77,3 +85,19 @@ function localgov_update_9502() {
$config->save(TRUE);
}
}

/**
* Update existing sites to use entity_usage for media.
*/
function localgov_update_9503() {
if (\Drupal::service('module_handler')->moduleExists('entity_usage')) {
$config_factory = \Drupal::configFactory();
$entity_usage_config = $config_factory->getEditable('entity_usage.settings');
$local_task_enabled_entity_types = $entity_usage_config->get('local_task_enabled_entity_types');
if (!in_array('media', $local_task_enabled_entity_types)) {
$local_task_enabled_entity_types[] = 'media';
$entity_usage_config->set('local_task_enabled_entity_types', $local_task_enabled_entity_types);
$entity_usage_config->save(TRUE);
}
}
}

0 comments on commit d2ce34c

Please sign in to comment.