This commit is contained in:
Naomi 2020-06-05 19:34:44 +01:00
parent 5d1844304a
commit c46bbc6ffd
3 changed files with 1 additions and 45 deletions

View File

@ -1,41 +1,5 @@
<?php <?php
// Make contact details revisionable.
function opencase_entities_update_80191() {
$update_manager = \Drupal::entityDefinitionUpdateManager();
$contact_details_fields = ['email', 'phone', 'phone2', 'postal_address', 'post_code'];
foreach($contact_details_fields as $field) {
$definition = $update_manager->getFieldStorageDefinition($field, 'oc_actor');
$definition->setRevisionable(TRUE);
}
}
use \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchemaConverter;
function opencase_entities_update_8019(&$sandbox) {
$schema_converter = new SqlContentEntityStorageSchemaConverter(
'oc_actor',
\Drupal::entityTypeManager(),
\Drupal::entityDefinitionUpdateManager(),
\Drupal::service('entity.last_installed_schema.repository'),
\Drupal::keyValue('entity.storage_schema.sql'),
\Drupal::database()
);
$contact_details_fields = ['email', 'phone', 'phone2', 'postal_address', 'post_code'];
$schema_converter->convertToRevisionable($sandbox, $contact_details_fields);
}
// Make contact details revisionable.
function opencase_entities_update_8018() {
$update_manager = \Drupal::entityDefinitionUpdateManager();
$contact_details_fields = ['email', 'phone', 'phone2', 'postal_address', 'post_code'];
foreach($contact_details_fields as $field) {
$definition = $update_manager->getFieldStorageDefinition($field, 'oc_actor');
$update_manager->updateFieldStorageDefinition($definition);
}
}
function opencase_entities_update_8016() { function opencase_entities_update_8016() {
$update_manager = \Drupal::entityDefinitionUpdateManager(); $update_manager = \Drupal::entityDefinitionUpdateManager();
$definition = $update_manager->getFieldStorageDefinition('activity_date_time', 'oc_activity'); $definition = $update_manager->getFieldStorageDefinition('activity_date_time', 'oc_activity');

View File

@ -300,22 +300,14 @@ class OCCase extends RevisionableContentEntityBase implements OCCaseInterface {
->setLabel(t('Created on')) ->setLabel(t('Created on'))
->setDescription(t('When the case was created.')) ->setDescription(t('When the case was created.'))
->setDisplayOptions('view', [ ->setDisplayOptions('view', [
'type' => "datetime_default",
'label' => 'above', 'label' => 'above',
'settings' => [
'date_format' => 'short'
]
]); ]);
$fields['changed'] = BaseFieldDefinition::create('changed') $fields['changed'] = BaseFieldDefinition::create('changed')
->setLabel(t('Last updated')) ->setLabel(t('Last updated'))
->setDescription(t('When the case was last edited.')) ->setDescription(t('When the case was last edited.'))
->setDisplayOptions('view', [ ->setDisplayOptions('view', [
'type' => "datetime_custom",
'label' => 'above', 'label' => 'above',
'settings' => [
'date_format' => 'm/d/Y'
]
]); ]);
$fields['revision_translation_affected'] = BaseFieldDefinition::create('boolean') $fields['revision_translation_affected'] = BaseFieldDefinition::create('boolean')

View File

@ -2,7 +2,7 @@ name: 'OpenCase'
type: module type: module
description: 'Simple Case Management' description: 'Simple Case Management'
core: 8.x core: 8.x
version: 8.x-1.8 version: 8.x-1.9
package: 'OpenCase' package: 'OpenCase'
dependencies: dependencies:
- opencase_entities - opencase_entities