Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
7f88d409f0 | |||
8841fd4d25 | |||
87241c1f87 | |||
2a1607c6d9 | |||
d8fd12a7b9 | |||
e4a04a254d | |||
88b5ce3d2e | |||
ae3976c7b8 | |||
f47ded38fa | |||
c63cae6b71 | |||
a7a96ab03c | |||
a6db6615df | |||
1c3370a784 |
@ -13,7 +13,6 @@ description: ''
|
||||
tag: ''
|
||||
base_table: oc_activity_field_data
|
||||
base_field: id
|
||||
core: 8.x
|
||||
display:
|
||||
default:
|
||||
display_plugin: default
|
||||
@ -233,7 +232,7 @@ display:
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: true
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
|
@ -465,20 +465,7 @@ display:
|
||||
entity_field: created
|
||||
plugin_id: date
|
||||
title: ''
|
||||
header:
|
||||
area:
|
||||
id: area
|
||||
table: views
|
||||
field: area
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
empty: true
|
||||
tokenize: false
|
||||
content:
|
||||
value: '<p>To <strong>add a new case</strong>, first search for the person you want to add it to. If the person is not on the system yet, you can add them using the "People" menu.</p>'
|
||||
format: basic_html
|
||||
plugin_id: text
|
||||
header: { }
|
||||
footer: { }
|
||||
empty:
|
||||
area_text_custom:
|
||||
|
@ -41,3 +41,8 @@ body {
|
||||
.block-superfish .menu ul li a:hover {
|
||||
color: black;
|
||||
}
|
||||
|
||||
/* In views, display label at top of field. Ths is because full descriptions are displayed in the activity view so having the label in the middle means it disappears down the page. */
|
||||
td.views-field {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
27
modules/opencase_entities/opencase_entities.install
Normal file
27
modules/opencase_entities/opencase_entities.install
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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)
|
||||
->setDefaultValueCallback('\Drupal\opencase_entities\Entity\OCActivity::currentDateTime')
|
||||
->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);
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ use Drupal\Core\Entity\RevisionableInterface;
|
||||
use Drupal\Core\Entity\EntityChangedTrait;
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\user\UserInterface;
|
||||
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem;
|
||||
use Drupal\Core\Datetime\DrupalDateTime;
|
||||
|
||||
/**
|
||||
* Defines the Activity entity.
|
||||
@ -81,6 +83,11 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
|
||||
return array(\Drupal::request()->query->get('case_id'));
|
||||
}
|
||||
|
||||
public static function currentDateTime() {
|
||||
$current_time = DrupalDateTime::createFromTimestamp(time());
|
||||
$formatted = $current_time->format(DateTimeItem::DATETIME_STORAGE_FORMAT);
|
||||
return $formatted;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -210,6 +217,24 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
|
||||
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
|
||||
$fields = parent::baseFieldDefinitions($entity_type);
|
||||
|
||||
$fields['activity_date_time'] = BaseFieldDefinition::create('datetime')
|
||||
->setLabel(t('Date and time'))
|
||||
->setRevisionable(TRUE)
|
||||
->setRequired(TRUE)
|
||||
->setDefaultValueCallback('\Drupal\opencase_entities\Entity\OCActivity::currentDateTime')
|
||||
->setDisplayOptions('view', [
|
||||
'label' => 'above',
|
||||
'type' => 'datetime_default',
|
||||
'settings' => [
|
||||
'format_type' => 'medium',
|
||||
],
|
||||
'weight' => -3,
|
||||
])
|
||||
->setDisplayOptions('form', [
|
||||
'type' => 'datetime_default',
|
||||
'weight' => -3,
|
||||
]);
|
||||
|
||||
// not currently in use. Will set view and form settings when ready
|
||||
$fields['status'] = BaseFieldDefinition::create('boolean')
|
||||
->setLabel(t('Publishing status'))
|
||||
|
@ -6,4 +6,3 @@ package: 'OpenCase'
|
||||
dependencies:
|
||||
- search_api
|
||||
- search_api_db
|
||||
- opencase
|
||||
|
@ -2,6 +2,7 @@ name: 'OpenCase'
|
||||
type: module
|
||||
description: 'Simple Case Management'
|
||||
core: 8.x
|
||||
version: 8.x-1.6.5
|
||||
package: 'OpenCase'
|
||||
dependencies:
|
||||
- opencase_entities
|
||||
|
Reference in New Issue
Block a user