protected static function EntityRevisionLogTrait::entityRevisionLogBaseFieldDefinitions in Entity API 8.0
Provides the base fields for the entity revision log trait.
Return value
\Drupal\Core\Field\BaseFieldDefinition[]
1 call to EntityRevisionLogTrait::entityRevisionLogBaseFieldDefinitions()
- EnhancedEntity::baseFieldDefinitions in tests/
modules/ entity_module_test/ src/ Entity/ EnhancedEntity.php - Provides base field definitions for an entity type.
File
- src/
Revision/ EntityRevisionLogTrait.php, line 23 - Contains \Drupal\entity\Revision\EntityRevisionLogTrait.
Class
- EntityRevisionLogTrait
- Provides a trait implementing \Drupal\entity\Revision\EntityRevisionLogInterface.
Namespace
Drupal\entity\RevisionCode
protected static function entityRevisionLogBaseFieldDefinitions() {
$fields = [];
$fields['revision_created'] = BaseFieldDefinition::create('created')
->setLabel(t('Revision create time'))
->setDescription(t('The time that the current revision was created.'))
->setRevisionable(TRUE);
$fields['revision_user'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Revision user'))
->setDescription(t('The user ID of the author of the current revision.'))
->setSetting('target_type', 'user')
->setRevisionable(TRUE);
$fields['revision_log_message'] = BaseFieldDefinition::create('string_long')
->setLabel(t('Revision log message'))
->setDescription(t('Briefly describe the changes you have made.'))
->setRevisionable(TRUE)
->setDefaultValue('')
->setDisplayOptions('form', [
'type' => 'string_textarea',
'weight' => 25,
'settings' => [
'rows' => 4,
],
]);
return $fields;
}