Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
- ...
- $fields['name'] = BaseFieldDefinition::create('string')
- ->setLabel(t('Name'))
- ->setDescription(t('The name of the entity.'))
- ->setSettings([
- 'max_length' => 50,
- 'text_processing' => 0,
- ])
- ->setDefaultValue('')
- ->setDisplayOptions('view', [
- 'label' => 'above',
- 'type' => 'string',
- 'weight' => -4,
- ])
- ->setDisplayOptions('form', [
- 'type' => 'string_textfield',
- 'weight' => -4,
- ])
- ->setDisplayConfigurable('form', TRUE)
- ->setDisplayConfigurable('view', TRUE);
Add Comment
Please, Sign In to add comment