Added Case Provision entity for recording caseworker involvement with cases
This commit is contained in:
44
modules/opencase_cases/opencase_cases.install
Normal file
44
modules/opencase_cases/opencase_cases.install
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Update 8023 - Create oc_case_provision entity
|
||||
*/
|
||||
function opencase_cases_update_8023() {
|
||||
//check if the table exists first. If not, then create the entity.
|
||||
if(!db_table_exists('oc_case_provision')) {
|
||||
\Drupal::entityTypeManager()->clearCachedDefinitions();
|
||||
\Drupal::entityDefinitionUpdateManager()
|
||||
->installEntityType(\Drupal::entityTypeManager()->getDefinition('oc_case_provision'));
|
||||
}
|
||||
}
|
||||
|
||||
/* remove it again*/
|
||||
function opencase_cases_update_8024() {
|
||||
$entity_update_manager = \Drupal::entityDefinitionUpdateManager();
|
||||
$entity_type = $entity_update_manager->getEntityType('oc_case_provision');
|
||||
$entity_update_manager->uninstallEntityType($entity_type);
|
||||
}
|
||||
|
||||
function opencase_cases_update_8025() {
|
||||
//check if the table exists first. If not, then create the entity.
|
||||
if(!db_table_exists('oc_case_provision')) {
|
||||
\Drupal::entityTypeManager()->clearCachedDefinitions();
|
||||
\Drupal::entityDefinitionUpdateManager()
|
||||
->installEntityType(\Drupal::entityTypeManager()->getDefinition('oc_case_provision'));
|
||||
}
|
||||
}
|
||||
|
||||
function opencase_cases_update_8026() {
|
||||
$storage_definition = \Drupal\Core\Field\BaseFieldDefinition::create('entity_reference')
|
||||
->setLabel(t('Role'))
|
||||
->setSetting('target_type', 'taxonomy_term')
|
||||
->setSetting('handler_settings', ['target_bundles' => ['oc_case_provider_role' => 'oc_case_provider_role']])
|
||||
->setSetting('handler', 'default')
|
||||
->setTranslatable(TRUE)
|
||||
->setCardinality(1)
|
||||
->setDisplayConfigurable("view", true)
|
||||
->setDisplayConfigurable("form", true)
|
||||
->setRequired(FALSE);
|
||||
\Drupal::entityDefinitionUpdateManager()
|
||||
->installFieldStorageDefinition('oc_case_provider_role', 'oc_case_provision', 'oc_case_provision', $storage_definition);
|
||||
}
|
Reference in New Issue
Block a user