Problem/Motivation
I can't seem to update the view display options in a custom taxonomy term entity reference field so that terms are printed without a link to the referenced term.
Steps to reproduce
- Create a taxonomy vocab with a couple of terms to reference.
- Create a custom entity.
- Add an entity_reference field similar to this:
$fields['region'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Region'))
->setDescription(t('The geographic region of the study.'))
->setRequired(TRUE)
->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
->setSettings([
'target_type' => 'taxonomy_term',
'handler' => 'default:taxonomy_term',
'handler_settings' => [
'target_bundles' => [
'region' => 'region'
]
]
])
->setDisplayOptions('form', [
'type' => 'options_shs',
'settings' => [
'force_deepest' => 0,
],
'weight' => 30,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'label',
'settings' => [
'link' => 0,
],
'weight' => 30,
])
->setDisplayConfigurable('view', TRUE);
Note that "setDisplayOptions - view" contains a setting for link = 0.
If you create a piece of content of this entity type, I expect the term to be displayed in plain text, but it is always rendering as a link. I believe my structure is correct but perhaps it's not - it's hard to find relevant documentation.
Please inform me of the correct structure, or flag it as bug to be investigated if need be. Thanks.