Skip to content
Snippets Groups Projects
Commit 3b621d93 authored by mindaugasd's avatar mindaugasd
Browse files

Issue #3437970 by mindaugasd: Add missing 'created' field

parent c2fba5c5
No related branches found
No related tags found
No related merge requests found
Pipeline #145836 passed with warnings
<?php
use Drupal\Core\Field\BaseFieldDefinition;
/**
* Add missing 'created' field
*/
function aichat_update_8001() {
$storage_definition = BaseFieldDefinition::create('created')
->setLabel(t('Authored on'))
->setDescription(t('The time that the conversation was created.'))
->setDisplayOptions('form', [
'region' => 'hidden'
])
->setDisplayConfigurable('form', TRUE);
$update_manager = \Drupal::entityDefinitionUpdateManager();
$update_manager->installFieldStorageDefinition('created', 'aichat', 'aichat', $storage_definition);
}
......@@ -108,9 +108,17 @@ class AIChat extends ContentEntityBase implements EntityChangedInterface, Entity
->setLabel(t('Enabled'))
->setDisplayConfigurable('form', TRUE);
$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Authored on'))
->setDescription(t('The time that the conversation was created.'))
->setDisplayOptions('form', [
'region' => 'hidden'
])
->setDisplayConfigurable('form', TRUE);
$fields['changed'] = BaseFieldDefinition::create('changed')
->setLabel(t('Changed'))
->setDescription(t('The time that the content was last edited.'));
->setDescription(t('The time that the conversation was last updated.'));
$fields['title'] = BaseFieldDefinition::create('string')
->setLabel(t('Title'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment