- Issue created by @coaston
- πΊπΈUnited States apmsooner
I'm not able to reproduce this issue. Every scenario I've tested there is no markup if the view is empty. You seem to have a few other modules in the mix like Entity Extra Field that perhaps is doing contributing? I don't really have an answer for you if I can't reproduce it and I don't use that other module.
- πΈπ°Slovakia coaston
First of all - My bad, I should mention that currently I am using Entity Extra field and would like to replace it and use only your "custom_field" module. That is the reason why I raised this issue.
Secondly. I am testing on clean drupal 10.5.1 latest version where currently only 2 contrib modules are installed 1.Custom_field and 2.ECA. I have also uninstalled already mentioned "Field Group" module.
I am quite surprised that you are not able to reproduce the issue because it is quite simple, but here you can find detailed step by step:
1. Create Content TYPE A (Project)
2. Create Content TYPE B (Project Inventory)
-on TYPE B - add field entity reference to Content type A3.Create dummy Project (content type A)
4.Create dummy Inventory with ref to Project.Create a View like "Project Inventories" of Type B.
-Add Relation ship - connect project with inventory (Ref to Project field)
-Add Title with relationship.
-Add Contextual filter - ID (with relationship and Provide default value : Content ID from URL)Now you should be able to see view only for specific Project ID.
5- on Content TYPE A - add field > custom_field with subfield viewfield and use that currently created view (Project Inventories)
6. Now go to our first project edit it and assign that viewfield with that view
7.You should be able to see our view displayed correctly.8.Now create new dummy project our viewfield and visit it.
9.You should be able to see at least label of our viewfield but also class in browser.Of course in Manage display I can disable all labels so I have tried but still it tries to render anything:
With above steps this you should be able to simply reproduce the issue.
I have mentioned Entity Extra field because there was exactly the same problem and it was resolved. Now it won't display/render anything in browser!.Another step is to install already mentioned Field group module, which uses tabs and if there is no any view rendered, the tab is hidden by default. In some cases our Projects don't have any Inventory at all so our customers would be confused what this tab means and why it is there displayed and empty. Thats why I would like to not see it if there no any inventory assigned to project.
Entity extra field basically does the same thing as your viewfield ,except it can render also blocks, but I don't use it for blocks, so I would love to uninstall it and use only your viewfield subfield as in my case it does the same.
Hope it makes sense now.
- πΊπΈUnited States apmsooner
There shouldn't be any special rendering functions needed here but views can be finicky about what it considers empty as there's all sorts of rewrite options and some displays react differently. I would probably need to see your config for all this to figure it out. Hit me up in slack if you want. Drupal.org commenting is really poor for attaching anything...