2020-02-22 14:10:46 +00:00
|
|
|
<?php
|
|
|
|
|
2020-06-08 13:21:16 +00:00
|
|
|
|
|
|
|
use \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchemaConverter;
|
|
|
|
|
|
|
|
function opencase_entities_update_80192(&$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);
|
|
|
|
}
|
|
|
|
|
2020-03-01 09:42:06 +00:00
|
|
|
function opencase_entities_update_8016() {
|
|
|
|
$update_manager = \Drupal::entityDefinitionUpdateManager();
|
|
|
|
$definition = $update_manager->getFieldStorageDefinition('activity_date_time', 'oc_activity');
|
|
|
|
$update_manager->updateFieldStorageDefinition($definition);
|
|
|
|
}
|
|
|
|
|
2020-02-22 14:10:46 +00:00
|
|
|
/**
|
|
|
|
* Add 'activity_date_time' field to 'oc_activity' entities.
|
|
|
|
*/
|
|
|
|
function opencase_entities_update_8003() {
|
|
|
|
$storage_definition = \Drupal\Core\Field\BaseFieldDefinition::create('datetime')
|
|
|
|
->setLabel(t('Date and time'))
|
|
|
|
->setRevisionable(TRUE)
|
2020-02-24 17:09:57 +00:00
|
|
|
->setDefaultValueCallback('\Drupal\opencase_entities\Entity\OCActivity::currentDateTime')
|
2020-02-22 14:10:46 +00:00
|
|
|
->setDisplayOptions('view', [
|
|
|
|
'type' => 'datetime_default',
|
|
|
|
'settings' => [
|
|
|
|
'format_type' => 'medium',
|
|
|
|
],
|
|
|
|
'label' => 'above',
|
|
|
|
'weight' => -3,
|
|
|
|
])
|
|
|
|
->setDisplayOptions('form', [
|
|
|
|
'type' => 'datetime_default',
|
|
|
|
'weight' => -3,
|
|
|
|
]);
|
|
|
|
|
|
|
|
\Drupal::entityDefinitionUpdateManager()
|
|
|
|
->installFieldStorageDefinition('activity_date_time', 'oc_activity', 'oc_activity', $storage_definition);
|
|
|
|
}
|