I am working with Drupal 8. And I want to create a field of entity_reference type. The field has a reference to context_question entity. And the field is displayed fine, but without any description beside the check boxes.
The context_question entity has a label field and I want exactly the label be displayed beside the checkbox in my first entity. What should I change in the code? Or do I need to create the fieldFormatter?
$fields['context_question'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Context Question'))
->setDescription(t('Reference to context-question-type'))
->setSetting('target_type', 'context_question')
->setDisplayOptions('view', array(
'label' => 'above',
'format' => 'label',
'weight' => 15,
))
->setDisplayOptions('form', array(
'type' => 'options_buttons',
'weight' => 15,
))
->setCardinality(1000)
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);