Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295530

Removing a relationship to an entity reference field can break a View

$
0
0

I have encountered an issue on multiple occasions since starting to build sites in D8 18 months ago. I can't find a matching issue in the Views queue that covers this, although have seen a couple of issues elsewhere that are possibly related/the same.

However, I've finally figured out how to reproduce it. I'm running Drupal 8.5.5.

The issue causes a View in development to become un-editable. The only workaround that I can find is to return to the main Views page and duplicate the view. This will give you a copy of the last saved version of the view, and you will lose any changes made since saving the view.

Steps to reproduce this:

  1. Create two content types (e.g. Testimonial and Services)
  2. Add an entity reference field to the Testimonial content type that references the Services content type.
  3. Create a view
  4. Add a block to the view
  5. Add fields from the Testimonial content type
  6. Add a Filter for the Testimonial content type, Content: Content type (= Testimonial)
  7. Add a Relationship to Services via the entity reference, Content referenced from field_related_services
  8. Edit the content type filter and specify the relationship you just created.
  9. Click the Relationship, then click Remove.

At this point, the Relationship box will flicker but will not disappear. You can close the box with the X, but if you refresh the screen, it will return the ever-helpful error:

The website encountered an unexpected error. Please try again later.

If you review the server log, you'll see something like this:

[Mon Jul 30 13:01:57.185616 2018] [:error] [pid 364:tid 140679086855936] [client 192.168.1.24.202:53768] Uncaught PHP Exception Exception: "No entity type for field type on view testimonials" at /var/www/html/drupal/web/core/modules/views/src/Plugin/views/HandlerBase.php line 711, referer: http://site.com/admin/structure/views


Viewing all articles
Browse latest Browse all 295530

Trending Articles