Enforce entity reference integrity on plan reference fields.

This commit is contained in:
Michael Stenta 2024-01-30 05:24:31 -05:00
parent 4f4f666c28
commit 8d25b32b01
2 changed files with 18 additions and 0 deletions

View File

@ -16,6 +16,7 @@ function farm_entity_install() {
'data_stream',
'file',
'log',
'plan',
'quantity',
'taxonomy_term',
'user',

View File

@ -0,0 +1,17 @@
<?php
/**
* @file
* Post update hooks for the farm_entity module.
*/
/**
* Enforce entity reference integrity on plan reference fields.
*/
function farm_entity_post_update_enforce_plan_eri(&$sandbox) {
$config = \Drupal::configFactory()->getEditable('entity_reference_integrity_enforce.settings');
$entity_types = $config->get('enabled_entity_type_ids');
$entity_types['plan'] = 'plan';
$config->set('enabled_entity_type_ids', $entity_types);
$config->save();
}