Problem/Motivation
After installing the module (version 2.0.4) and clearing the cache, the field does not appear in the list of fields when adding a new field.
Steps to reproduce
1. Install Module
2. Clear Cache
3. Add a field to a content type
4. "Display Mode" is not an option
Proposed resolution
The issue is in the field definition of the field type file. The category says "reference" when it should have a capital R.
Current:
/**
* Plugin implementation of the 'entity_reference_display' field type.
*
* @FieldType(
* id = "entity_reference_display",
* label = @Translation("Display mode"),
* description = @Translation("This field allows you to specify a display mode for entity reference field."),
* category = "reference",
* default_widget = "options_select",
* default_formatter = "list_default"
* )
*/
Fix:
/**
* Plugin implementation of the 'entity_reference_display' field type.
*
* @FieldType(
* id = "entity_reference_display",
* label = @Translation("Display mode"),
* description = @Translation("This field allows you to specify a display mode for entity reference field."),
* category = @Translation("Reference"),
* default_widget = "options_select",
* default_formatter = "list_default"
* )
*/
Comments
Comment #3
arparker commentedPushed a fix to the FieldType file. Working on my local. Ready to be tested.
Comment #4
arparker commentedComment #5
jgraca commentedI also faced this issue and the fix by changing
* category = "reference",to
* category = "Reference",worked.
Changing it to
* category = @Translation("Reference"),I got the error:
Uncaught PHP Exception TypeError: "Cannot access offset of type Drupal\Core\StringTranslation\TranslatableMarkup in isset or empty" at web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php line 45
Comment #6
norman.lolThe module works as designed. It's just that you find the field under the reference fields now, not in the first level. The project page might need to get updated, reflecting that.