Guest User

Untitled

a guest
Dec 14th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
  2. ...
  3. $fields['name'] = BaseFieldDefinition::create('string')
  4. ->setLabel(t('Name'))
  5. ->setDescription(t('The name of the entity.'))
  6. ->setSettings([
  7. 'max_length' => 50,
  8. 'text_processing' => 0,
  9. ])
  10. ->setDefaultValue('')
  11. ->setDisplayOptions('view', [
  12. 'label' => 'above',
  13. 'type' => 'string',
  14. 'weight' => -4,
  15. ])
  16. ->setDisplayOptions('form', [
  17. 'type' => 'string_textfield',
  18. 'weight' => -4,
  19. ])
  20. ->setDisplayConfigurable('form', TRUE)
  21. ->setDisplayConfigurable('view', TRUE);
Add Comment
Please, Sign In to add comment