Skip to content

Commit

Permalink
Merge pull request #24 from City-of-Helsinki/UHF-X-remove-platform-co…
Browse files Browse the repository at this point in the history
…nfig-dependency

Removed platform config dependency, fixed module name
  • Loading branch information
tuutti authored Jan 31, 2023
2 parents 81b0429 + eba147c commit 4e20e6d
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions helfi_navigation.install
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ declare(strict_types = 1);
use Drupal\block\Entity\Block;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\helfi_platform_config\ConfigHelper;
use Drupal\rest\Entity\RestResourceConfig;

/**
* Implements hook_install().
Expand Down Expand Up @@ -256,14 +256,23 @@ function helfi_navigation_update_9003() : void {
if (!$module_handler->moduleExists('rest')) {
Drupal::service('module_installer')->install(['rest']);
}
if (!$module_handler->moduleExists('serialize')) {
if (!$module_handler->moduleExists('serialization')) {
Drupal::service('module_installer')->install(['serialization']);
}

// Install config.
$config_location = dirname(__FILE__) . '/config/install/';
$config = 'rest.resource.helfi_global_mobile_menu';
ConfigHelper::installNewConfig($config_location, $config);
if (!RestResourceConfig::load('helfi_global_mobile_menu')) {
RestResourceConfig::create([
'id' => 'helfi_global_mobile_menu',
'status' => TRUE,
'plugin_id' => 'helfi_global_mobile_menu',
'granularity' => 'resource',
'configuration' => [
'methods' => ['GET'],
'formats' => ['json'],
'authentication' => ['cookie'],
],
])->save();
}

// Update user permissions.
update_user_rest_permissions();
Expand Down

0 comments on commit 4e20e6d

Please sign in to comment.