Where can I find all form display options types for custom entity fields?

by Coder1   Last Updated December 14, 2017 17:07 PM

I created a custom entity with drupal generate:entity:content.

I am adding fields in the baseFieldDefinitions method of the entity class.

Below is what drupal console generates by default for the name field.

Where I can find a list of all possible type values for ->setDisplayOptions('form'). For example, the field below uses string_textfield.

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);
Tags : 8 entities


Related Questions




How to create a custom template for entities?

Updated April 07, 2015 03:03 AM


Drupal 8 Custom Entities from a UI?

Updated July 14, 2015 15:03 PM