Closed (fixed)
Project:
Reference value pair
Version:
8.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
8 Dec 2016 at 14:56 UTC
Updated:
12 Mar 2026 at 13:30 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
miiimoooYes this is a big problem. Related issues are #2827177: Delete references to deleted entities Drupal 8 and #1368386: Delete references to deleted entities with the added complexity of what should happen with the value.
See this comment for possible approaches https://www.drupal.org/node/1368386#comment-11834828
For entity references in D7 this deletion issue is handled by some additional contrib modules. Maybe it's too big to handle it here. In my opinion there should be some setting to at least display the value when the entity reference is invalid or empty.
Comment #3
miiimoooAttached a first go at this: It adds two elements to the field formatter settings:
* Display invalid reference
* Invalid reference label
Depending on what you chose you can set the formatters to display just the value or a custom label like "(None)" or "(Deleted)".
For developers: if you have your own custom formatter and it's based EntityReferenceFormatterBase like the two formatters that come with the module then you can use the new ReferenceValueFormatterBase as a drop-in replacement to get this extra functionality (but also needs some code adjustments as now entity can be NULL - the label is set in the _label property).
Comment #4
isaacrc commentedThis was already merged here: https://git.drupalcode.org/project/reference_value_pair/-/commit/60f23fb... 8 years ago so I'll close the issue.
Comment #6
isaacrc commented