public static function Accepted::baseFieldDefinitions in Legal 8
Same name and namespace in other branches
- 2.0.x src/Entity/Accepted.php \Drupal\legal\Entity\Accepted::baseFieldDefinitions()
Define the field properties here.
Field name, type and size determine the table structure.
In addition, we can define how the field and its content can be manipulated in the GUI. The behaviour of the widgets used can be determined here.
Overrides ContentEntityBase::baseFieldDefinitions
File
- src/
Entity/ Accepted.php, line 94
Class
- Accepted
- Defines the Legal Terms & Conditions accepted entity.
Namespace
Drupal\legal\EntityCode
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
// Standard field, used as unique if primary index.
$fields['legal_id'] = BaseFieldDefinition::create('integer')
->setLabel(t('ID'))
->setDescription(t('The ID of the Acceptance.'))
->setReadOnly(TRUE);
// Standard field, unique outside of the scope of the current project.
$fields['uuid'] = BaseFieldDefinition::create('uuid')
->setLabel(t('UUID'))
->setDescription(t('The UUID of the acceptance.'))
->setReadOnly(TRUE);
$fields['version'] = BaseFieldDefinition::create('integer')
->setLabel(t('Version'))
->setDescription(t('The version number of the Terms & Conditions.'));
$fields['revision'] = BaseFieldDefinition::create('integer')
->setLabel(t('Revision'))
->setDescription(t('The revision number of the Terms & Conditions.'));
$fields['language'] = BaseFieldDefinition::create('language')
->setLabel(t('Language code'))
->setDescription(t('Language code of the T&C accepted.'));
$fields['uid'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('User'))
->setDescription(t('The user that accepted the T&Cs.'))
->setSetting('target_type', 'user')
->setSetting('handler', 'default');
$fields['accepted'] = BaseFieldDefinition::create('created')
->setLabel(t('Created'))
->setDescription(t('When the Terms & Conditions were accepted.'));
return $fields;
}