Adding a field named 'comment' to an entity can not then be displayed in an Entity view, becuase the renderer will find the template named 'comment' (found in core/themes/classy/templates/field/field--comment.html.twig) and use that instead of the template for the widget defined in the view display options.

<?php

$fields['comment'] = BaseFieldDefinition::create('string_long')
    ->setLabel(t('Our comment'))
    ->setDisplayOptions('view', [
        'weight' => -5,
    ])
    ->setDisplayOptions('form', array(
        'weight' => -5,
    ));

The above field definition results in:
* Add form: a textarea allowing me to type comment and save it - this is correct
* Entity view: when I view the entity using default view builder, the field is ommitted from the view - this is wrong, it should display the value of the entity's 'comment' field.

Comments

despero created an issue. See original summary.

cilefen’s picture

Priority: Major » Normal

Having regarded this, I cannot consider it major priority according to our policy. If you want to argue that one of the major issue bullet points applies, then make a case for it.

despero’s picture

Agreed.
Developers wasting their time are not in the list.

Just imagined all time wasted because of something that just does not make sense like this bug by all developers combined is a major of waste of people's lives, thus marked as major.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Berdir’s picture

Sounds like a practical example of the generic issue #1367354: The list of theme hook suggestions for "field" is incorrectly ordered and has namespacing collisions and kind of a duplicate of that.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.