v1.7 - adding datetime field with correct datepicker type & default datetime
This commit is contained in:
parent
c63cae6b71
commit
f47ded38fa
@ -1,15 +1,5 @@
|
||||
<?php
|
||||
|
||||
function opencase_entities_update_8013() {
|
||||
$update_manager = \Drupal::entityDefinitionUpdateManager();
|
||||
$definition = $update_manager->getFieldStorageDefinition('activity_date_time', 'oc_activity');
|
||||
// $definition->setDescription('');
|
||||
// $definition->setRequired('');
|
||||
//->setDefaultValueCallback('Drupal\opencase_entities\Entity\OCActivity::currentDateTime')
|
||||
$update_manager->updateFieldStorageDefinition($definition);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add 'activity_date_time' field to 'oc_activity' entities.
|
||||
*/
|
||||
@ -18,10 +8,7 @@ function opencase_entities_update_8003() {
|
||||
->setLabel(t('Date and time'))
|
||||
->setDescription(t('When the activity started.'))
|
||||
->setRevisionable(TRUE)
|
||||
->setSettings([
|
||||
'datetime_type' => 'date'
|
||||
])
|
||||
->setDefaultValue('2000-01-01')
|
||||
->setDefaultValueCallback('Drupal\opencase_entities\Entity\OCActivity::currentDateTime')
|
||||
->setDisplayOptions('view', [
|
||||
'type' => 'datetime_default',
|
||||
'settings' => [
|
||||
|
@ -87,7 +87,6 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
|
||||
$current_time = DrupalDateTime::createFromTimestamp(time());
|
||||
$formatted = $current_time->format(DateTimeItem::DATETIME_STORAGE_FORMAT);
|
||||
\Drupal::logger("nr_debug")->notice($formatted);
|
||||
$formatted="2010-10-10";
|
||||
return $formatted;
|
||||
}
|
||||
/**
|
||||
@ -224,9 +223,6 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
|
||||
->setDescription('')
|
||||
->setRevisionable(TRUE)
|
||||
->setRequired(TRUE)
|
||||
->setSettings([
|
||||
'datetime_type' => 'date'
|
||||
])
|
||||
->setDefaultValueCallback('Drupal\opencase_entities\Entity\OCActivity::currentDateTime')
|
||||
->setDisplayOptions('view', [
|
||||
'label' => 'above',
|
||||
|
Reference in New Issue
Block a user