Hi there!
Nice module - exactly what I needed - many thanks for your work.
I am not sure whether this should be a support request or a bug report:
I embed a view directly into a node by doing this:
$view = views_get_view('MyView');
if ($view) {
$view->url = $_GET['q'];
print views_build_view('embed', $view, array('MyArg'), FALSE, NULL);
}
The point is that this view selects CCK nodes that contain a field of type view_field.
Now, my view contains a display field that refers to the nodes' view_field and has the format 'count', so I expect a table along the lines:
NUMBER OF NODES SELECTED BY THE
NODE ID VIEW EMBEDDED INTO THE NODE WITH
THE ID FOUND IN LEFT COLUMN
x a
y b
z c
But the right column is always empty.
This happens when the view is set to display as a table or as a list, but when it is displayed as a teaser list or as full nodes everything is working fine.
I did a little debugging - hopefully this will help:
The function viewfield_field_formatter should be called to properly print the number of items selected by the view_fields, but it is never called. This is because the Views API constructs complete nodes for teaser or full display, but it does not for table or list display. Instead, it uses functions like views_theme_field (in views.module) to construct queries on the basis of variable names. Since the number of items matching a view is not stored in the DB, but is a result of a query, something must be going wrong here.
I assume that to fix the problem one must override one or more of the views_theme... hooks. But I am not a Drupal expert, so I hope that the developers of this great module can find the solution better than I can and that they can integrate it into the module.
In the meantime I will try to live without the item counts in tables.
Cheers!
Comments
Comment #1
darren ohDuplicate of issue 165321.
Comment #2
gragus commentedHi,
(sorry for my slow reply, I was not looking at this for a few days.)
Thanks a lot for you answer! Just a few quick questions.
- The patch you link to is attached to the issue report 165321 that is reported against view_field 5.x-1.4.
I am using the current version 5.x-1.5. Can I apply this patch without further changes?
- If you recommend this patch, why is it not included in the official view_field release?
Is there something I should be aware of when installing the patch?
Many thanks & cheers!
Comment #3
darren ohI know the patch will solve your problem, but I am not sure it is the final solution.
Comment #4
gragus commentedI tried the patch but it does not help.
Apparently, the patch is against version 1.2, and version 1.5 source code has changed. I applied the patch manually by editing the module file, but still - no display in the count column. Assuming that maybe the patch is not compatible, I have replaced the module file with
patched5.x-1.2_viewfield.modulethat comes along with the patch (obviously, renaming it correctly). Still no joy.It may be that the patch assumes a DB structure that has changed in ver. 1.5 or it may not actually solve this specific problem.
Do you have any ideas?
Is there any specific additional info I could give you that may help?
Many thanks!