3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00

Merge branch '2.x-remove_config_rewrite' into 2.x

This commit is contained in:
Michael Stenta 2021-09-16 19:23:41 -04:00
commit 80a687d6bd
13 changed files with 58 additions and 26 deletions

View file

@ -19,7 +19,6 @@
"cweagans/composer-patches": "^1.6",
"drupal/admin_toolbar": "^2.4",
"drupal/core": "~9.1.2",
"drupal/config_rewrite": "^1.4",
"drupal/config_update": "^1.7",
"drupal/csv_serialization": "^2.0",
"drupal/date_popup": "^1.1",

View file

@ -1 +0,0 @@
read_only: false

View file

@ -1 +0,0 @@
path_prefix: api

View file

@ -1,8 +0,0 @@
access_token_expiration: 3600
authorization_code_expiration: 300
refresh_token_expiration: 1209600
token_cron_batch_size: 0
public_key: "../keys/public.key"
private_key: "../keys/private.key"
remember_clients: true
use_implicit: false

View file

@ -4,7 +4,6 @@ type: module
package: farmOS
core_version_requirement: ^9
dependencies:
- config_rewrite:config_rewrite
- drupal:jsonapi
- entity:entity
- jsonapi_extras:jsonapi_extras

View file

@ -12,6 +12,25 @@ use Drupal\consumers\Entity\Consumer;
*/
function farm_api_install() {
// Allow JSON:API write operations.
\Drupal::configFactory()->getEditable('jsonapi.settings')->set('read_only', FALSE)->save();
// Change the base JSON:API path to /api.
\Drupal::configFactory()->getEditable('jsonapi_extras.settings')->set('path_prefix', 'api')->save();
// Load the simple_oauth module settings.
$simple_oauth_settings = \Drupal::configFactory()->getEditable('simple_oauth.settings');
// Increase access token expiration time to 1 hour.
$simple_oauth_settings->set('access_token_expiration', 3600);
// Explicitly set the public/private key path.
$simple_oauth_settings->set('public_key', '../keys/public.key');
$simple_oauth_settings->set('private_key', '../keys/private.key');
// Save simple_oauth settings.
$simple_oauth_settings->save();
// Generate key files for simple_oauth module.
// Code adapted from the contenta_jsonapi profile install tasks:
// https://github.com/contentacms/contenta_jsonapi/blob/8.x-3.x/contenta_jsonapi.profile

View file

@ -1,8 +0,0 @@
enabled_entity_type_ids:
asset: asset
data_stream: data_stream
file: file
log: log
quantity: quantity
taxonomy_term: taxonomy_term
user: user

View file

@ -4,7 +4,6 @@ type: module
package: farmOS
core_version_requirement: ^9
dependencies:
- config_rewrite:config_rewrite
- drupal:file
- drupal:geofield
- drupal:image

View file

@ -0,0 +1,24 @@
<?php
/**
* @file
* Install, update and uninstall functions for the farm_entity module.
*/
/**
* Implements hook_install().
*/
function farm_entity_install() {
// Enforce entity reference integrity on the entity types we care about.
$enforced_entity_types = [
'asset',
'data_stream',
'file',
'log',
'quantity',
'taxonomy_term',
'user',
];
\Drupal::configFactory()->getEditable('entity_reference_integrity_enforce.settings')->set('enabled_entity_type_ids', array_combine($enforced_entity_types, $enforced_entity_types))->save();
}

View file

@ -11,7 +11,5 @@
function farm_ui_dashboard_install() {
// Set the front page to /dashboard.
// We cannot set this with config_rewrite because it breaks the config. See:
// https://www.drupal.org/project/config_rewrite/issues/3085330
\Drupal::configFactory()->getEditable('system.site')->set('page.front', '/dashboard')->save();
}

View file

@ -0,0 +1,15 @@
<?php
/**
* @file
* Install, update and uninstall functions for the farm_ui_location module.
*/
/**
* Implements hook_install().
*/
function farm_ui_location_install() {
// Use light mode for inspire tree.
\Drupal::configFactory()->getEditable('inspire_tree.settings')->set('mode', 'light')->save();
}

View file

@ -11,7 +11,5 @@
function farm_ui_user_install() {
// Set the default 403 page to /403.
// We cannot set this with config_rewrite because it breaks the config. See:
// https://www.drupal.org/project/config_rewrite/issues/3085330
\Drupal::configFactory()->getEditable('system.site')->set('page.403', '/403')->save();
}