Closed (fixed)
Project:
EVA: Entity Views Attachment
Version:
3.0.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Sep 2019 at 14:58 UTC
Updated:
9 Oct 2024 at 13:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
dkosbob commentedComment #3
ahebrank commentedThis makes sense to me -- certainly used to frustrate me during theming.
Can you move the visibility check (
if ($this->outputIsEmpty() && $this->getOption('eva_hide_empty') && empty($this->view->style_plugin->definition['even empty']))) into a new handler method and call that method where needed from the handler and eva.module?Looking through the API,
!$this->view->getStyle()->evenEmpty()might be a safer way to get the style plugin setting.Seeking feedback/testing from others.
Comment #4
dkosbob commentedYes, here is a new patch. I've added a buildRenderable() method to the Eva class, and am doing the check there. It seems to be working as intended in my dev environment, but I'd appreciate some other eyes on this.
Comment #5
aaronbaumanIs it a problem that
parent::buildRenderable()doesn't get called?Looks like \Drupal\views\Plugin\views\display\DisplayPluginBase::buildRenderable() adds cache metadata.
How will this change impact views' caching and overall performance?
Calling \Drupal\views\ViewExecutable::execute() during buildRenderable() doesn't seem like a great idea either.
I think your first instinct to check during \Drupal\eva\Plugin\views\display\Eva::execute() was better
Comment #6
aaronbaumanThis patch:
- Adds protected method "shouldDisplayOutput()" to calculate whether to return a renderable
- Moves the call back into execute(), ditching the buildRenderable() override
Comment #7
dkosbob commentedThis looks good to me and makes sense. I'm using patch #6 on a pre-production site and it's working well.
Comment #8
aaronbaumanBumping this
Comment #9
wrd commentedThe option is now available and configurable, but I'm still getting the empty markup output. In my case, I'm placing the EVA in a Layout Builder region.
Comment #10
brandonratz commentedI can configure the option but same output in
container.html.twigwhich triggers a field_group to display. Not yet working.Comment #11
hanoiiI think I fixed this, as we're also having the issue in which there was something being rendered.
I basically am doing the same thing as ViewsBlock.php does when the field is being added to the entity (outside of the view).
I also refactor the plugin patch slightly. I removed the method and copy over what core's block plugin does. Easier to diff and to keep upstream changes. The new method can be done on a separate issue/commit if really desired. Also changing the negation of the conditions as per the above.
Comment #12
hanoiiI'd also move the option to the Other section (exactly as block) but in a way made more sense to have it there.
Comment #13
hanoiiComment #14
brandonratz commented#11 works as expected in our use cases.
Comment #15
aaronbaumanbumping again
Comment #16
dries arnoldsThis was my first time using EVA in the D8 version and I was surprised that it didn't work the same way as the D7 version.
Tested the patch in #11 and it works as expected. Can we get this committed?
Comment #17
aaronbaumanbump
Comment #18
pakmanlhI can confirm the #11 patch works using the 3.0 version and Drupal 10 versions too.
Comment #20
ahebrank commentedComment #22
anybodyFYI: Looks like the default should have been TRUE to match the previous behavior and hide the view entirely, if empty... we were wondering why EVA views that were not appearing before, suddenly appeared...
Just to let others know, running into this.