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
Comment #2
cilefen commentedHaving 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.
Comment #3
despero commentedAgreed.
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.
Comment #5
berdirSounds 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.
Comment #7
ivan berezhnov commentedComment #13
darvanenTriaged as part of the Bug Smash Initiative.
Closing as duplicate of #1367354: The list of theme hook suggestions for "field" is incorrectly ordered and has namespacing collisions.
If that is wrong, please reopen by setting to 'Active' and add a comment explaining why.