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

Refactor farm_entity config_rewrite settings into hook_install().

This commit is contained in:
Michael Stenta 2021-09-16 17:32:51 -04:00
parent e2d822ac4a
commit 505dc83130
3 changed files with 24 additions and 9 deletions

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();
}