Filtering Entity Reference Fields: How to Enforce Selection of Published Contents
In Drupal, the default behaviour of entity reference fields allows us to select unpublished content if the content creator has permission to view unpublished content, which can be useful in specific scenarios where we need to establish relationships even with unpublished content.
However, in many cases, we want to refer only to published content. The problem arises when we add references during content creation without verifying whether the referenced items are published. This can lead to confusion later when we wonder why the referenced contents are not visible when viewing the content.
Here's a step-by-step guide on how to use a Drupal view to filter the values appearing in an entity reference field