made activity date and time field configurable

This commit is contained in:
naomi 2021-11-16 07:05:07 +00:00
parent 88cd511d9f
commit f9d4820ac2

View File

@ -225,25 +225,14 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
$fields['activity_date_time'] = BaseFieldDefinition::create('datetime') $fields['activity_date_time'] = BaseFieldDefinition::create('datetime')
->setLabel(t('Date and time')) ->setLabel(t('Date and time'))
->setRevisionable(TRUE) ->setRevisionable(TRUE)
->setRequired(TRUE)
->setDefaultValueCallback('\Drupal\opencase_entities\Entity\OCActivity::currentDateTime') ->setDefaultValueCallback('\Drupal\opencase_entities\Entity\OCActivity::currentDateTime')
->setDisplayConfigurable('form', true) ->setDisplayConfigurable('form', true)
->setDisplayConfigurable('view', true) ->setDisplayConfigurable('view', true)
->setSettings([ ->setSettings([
'datetime_type' => 'date' 'datetime_type' => 'date'
]) ])
->setDisplayOptions('view', [ ->setDisplayConfigurable('form', TRUE)
'label' => 'above', ->setDisplayConfigurable('view', TRUE);
'type' => 'datetime_default',
'settings' => [
'format_type' => 'short',
],
'weight' => -3,
])
->setDisplayOptions('form', [
'type' => 'datetime_default',
'weight' => -3,
]);
$fields['status'] = BaseFieldDefinition::create('boolean') $fields['status'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Publishing status')) ->setLabel(t('Publishing status'))