How to add comment field to custom entity I tried to add a comment field in the Basefieldsdefinitions of my custom entity but in my view the add comment form doesn't appear:

Here's the basefielddefinition

 $fields['comments'] = BaseFieldDefinition::create('comment')
  -&gt;setLabel(t('Kommentare'))
  -&gt;setDescription(t('Kommentare.'))

  -&gt;setSettings(
    array(
      'default_mode'=&gt; 1,
      'per_page'=&gt;50,
      'anonymous'=&gt; 0,
      'form_location'=&gt;1,
      'preview'=&gt; 1,
      'comment_type'=&gt;'image_comment',
      'locked'=&gt;false,

      ))
-&gt;setDefaultValue(
        array(
            'status'=&gt;2,
            'cid'=&gt;0,
            'last_comment_timestamp'=&gt; 0,
            'last_comment_name'=&gt; null,
            'last_comment_uid'=&gt; 0,
            'comment_count'=&gt; 0,
)
)
-&gt;setDisplayOptions('form', array(
 'type' =&gt; 'comment_default',
 'settings' =&gt; array(
   'form_location' =&gt; 1,
   'default_mode'=&gt; 1,
   'per_page'=&gt;50,
   'anonymous'=&gt; 0,
   'form_location'=&gt;1,
   'preview'=&gt; 1,
   'comment_type'=&gt;'image_comment',
   'locked'=&gt;false,

 ),
 'weight' =&gt; 1,
))
-&gt;setDisplayConfigurable('form', TRUE)
-&gt;setDisplayConfigurable('view', TRUE);
In order to any changes on BaseFieldDefinition effects, you should uninstall/install your module.
your syntax seems Ok and I  only guest you did some changes after your module( entity) installed.