Problem/Motivation
You cannot create a view and try to list rendered entities using relationship.
Steps to reproduce (based on Standard profile):
- Add an entity reference field named "field_content" to the "page" content type. Allow content > article references.
- Create and edit a content view.
- Add a relationship for "Content using field_content." or "Content referenced from field_content."
- The row style plugin is "Content" by default.
- Click on "Teaser" in order to change the view mode, nothing happens.
- You can't choose a view mode even if you don't want to actually use a relationship, just having one on your view triggers this.
The problem is a fatal AJAX error triggered when RowPluginBase::buildOptionsForm()
calls RelationshipPluginBase::init()
while providing a wrong argument type (Array
instead of DisplayPluginBase
).
Argument 2 passed to Drupal\views\Plugin\views\relationship\RelationshipPluginBase::init() must be an instance of Drupal\views\Plugin\views\display\DisplayPluginBase, array given, called in /app/web/core/modules/views/src/Plugin/views/row/RowPluginBase.php on line 93
Proposed resolution
Fix it, by passing along the relationship as needed and using it.
Remaining tasks
None.
User interface changes
None
API changes
None
Task | Novice task? | Contributor instructions | Complete? |
---|---|---|---|
Create a patch | Instructions |