Added "time taken" base field to activity

Also removed case field from activity display. It is in the sidebar, no need to have it twice.
This commit is contained in:
naomi 2018-05-11 13:19:28 +02:00
parent 98d856303a
commit b8e49fb9cb

View File

@ -256,10 +256,6 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
->setSetting('handler', 'default')
->setTranslatable(TRUE)
->setCardinality(1)
->setDisplayOptions('view', [
'label' => 'above',
'weight' => -2
])
->setDefaultValueCallback('Drupal\opencase_entities\Entity\OCActivity::defaultVal')
->setRequired(TRUE);
@ -282,6 +278,23 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
])
->setRequired(FALSE);
$fields['time_taken'] = BaseFieldDefinition::create('integer')
->setLabel(t('Time taken'))
->setRevisionable(TRUE)
->setSettings([
'suffix' => 'minutes',
])
->setDefaultValue('')
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'number',
'weight' => -3,
])
->setDisplayOptions('form', [
'type' => 'number',
'weight' => -3,
]);
$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Created'))
->setDescription(t('The time that the entity was created.'));