How do I find or set the apropriate form for base scheme fields? In my custom entity I want to set a base scheme field, which is an integer. The field has a minimum of 0, a maximum of 360 and a default of 180.

I tried this so:

    $fields['pan'] = BaseFieldDefinition::create('integer')
  -&gt;setLabel(t('PAN'))
  -&gt;setDescription(t('Horizontal Positioning'))
  -&gt;setSettings(array(
    'default_value' =&gt; 180,
    'min_value' =&gt; 0,
    'max_value' =&gt; 360
  ))
  -&gt;setDisplayOptions('view', array(
    'label' =&gt; 'inline',
    'type' =&gt; 'default',
    'weight' =&gt; -3,
  ))
  -&gt;setDisplayOptions('form', array(
    'type' =&gt; 'number',
    'weight' =&gt; -3,
    'settings' =&gt; array( 
      'default_value' =&gt; 180,
      'min' =&gt; 0,
      'max' =&gt; 360
    ),
  ))
  -&gt;setDisplayConfigurable('form', TRUE)
  -&gt;setDisplayConfigurable('view', TRUE);


Neither the form is limited nor the input is limited when I post.

How can I get the correct type for my form and the correct settings? How can I look for them? Where? 

Edit: solution is the following:

    $fields['pan'] = BaseFieldDefinition::create('integer')
  -&gt;setLabel(t('PAN'))
  -&gt;setDescription(t('Horizontal Positioning'))
  -&gt;setDefaultValue(180)
  -&gt;setSettings(array(
    'min' =&gt; 0,
    'max' =&gt; 360
  ))
  -&gt;setDisplayOptions('view', array(
    'label' =&gt; 'inline',
    'type' =&gt; 'number_integer',
    'weight' =&gt; -3,
  ))
  -&gt;setDisplayOptions('form', array(
    'type' =&gt; 'number',
    'weight' =&gt; -3,
  ))
  -&gt;setDisplayConfigurable('form', TRUE)
  -&gt;setDisplayConfigurable('view', TRUE);
You can always create a field with the desired settings in the field, widget and formatter settings in the UI. Then export the configuratio and use the settings from there. The field settings are in two files:


field.storage.entity_type.yourname.yml
field.field.entity_type.bundle.yourname.yml


For base fields, you can merge the settings together into a single array.