The Views plugin "Rendered Entity" patch introduced in 8.7.9 removed the check for the entity existence, what is breaking views if the entity don't exist?
This piece of code
if (!$entity = $this->getEntity($values)) {
return [];
}
in the public function render of Drupal\views\Plugin\views\field\RenderedEntity was replaced by
$entity = $this->getEntityTranslation($this->getEntity($values), $values);
Now if the entity being checked is for example an Anonymous user without language, some views are broken.
Scenario
- Fresh install of drupal/social
- Enable anonymous users to enroll in events
- Create an event and allow anonymous users to enroll
- Enroll as anonymous user to that event
- As admin, visit the "manage enrollments tab" /node/[nid]/all-enrollments
The view is broken.
Temp resolution
Add the check for entity existence back
if (!$entity = $this->getEntity($values)) {
return [];
}
Comments
Comment #2
sibopa commentedComment #3
lendudeThe line pointed out in the IS and the patch in #2 have been that way since the plugin was introduced in #2632068: Rendered entity views field handler.
So if this broke at some point, it was not due to a change to that specific line...
Were you maybe using a patch from #3007424: Multiple usages of FieldPluginBase::getEntity do not check for NULL, leading to WSOD?
Closing this as a duplicate of #3007424: Multiple usages of FieldPluginBase::getEntity do not check for NULL, leading to WSOD since that changes this check an a great number more to prevent this error from turning up.
Comment #4
sibopa commentedThanks!
I think you are right. I'm using drupal/social which have the #3007424 patch. That's probably what is breaking the view.