Drupal 11.1 Adds New EntityReference Filter for Views Customization

Developer
DC Studio / Freepik

Drupal 11.1 introduces a new EntityReference filter for Views, offering users greater flexibility in how exposed filters are displayed. Previously, entity reference fields were limited to simple text input filters, but with this update, they can now be presented as select boxes or autocomplete fields. This enhancement provides a more user-friendly experience for managing related content within Drupal Views.

However, the new filter is not enabled by default. Developers must implement a `hook_views_data_alter()` to activate it for specific fields. Goran Nikolovski, a web and AI developer with over 10 years of experience, demonstrated how to apply this hook for the `field_related_articles` field, showing how the filter can be customized to display as a select or autocomplete input.

The update is seen as a significant improvement in Drupal 11.1, making it easier to manage entity relationships within Views. Goran has provided step-by-step guidance on how to enable the new filter, with further details available in the official change record.

Source Reference

Date of Publication

Disclosure: This content is produced with the assistance of AI.

Disclaimer: The opinions expressed in this story do not necessarily represent that of TheDropTimes. We regularly share third-party blog posts that feature Drupal in good faith. TDT recommends Reader's discretion while consuming such content, as the veracity/authenticity of the story depends on the blogger and their motives. 

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please reach out to us at #thedroptimes channel on Drupal Slack and we will try to address the issue as best we can.

Related People

Upcoming Events

Latest Opportunities