I know there are some easy tricks to hide Views fields conditionally (catchword: hide if empty). None of them seems to work for me. Also hook_views_pre_render()
or other preprocess approaches didn't work since they never touch the row in a way where I could have unset that certain field I'ld like to hide conditionally.
This is the setup I have to work with:
[field 1] hidden from display
[field 2] hidden from display
[field 3] hidden from display and rewritten to output <markup>[field 1][field 2]</markup>
[field 4] hidden from display
[field 5] rewritten to output <markup>[field 3][field 4]</markup>
I'ld like to unset [field 3]
if comments of that row's nid are closed (if ($node->comment != 2)
). I think maybe field handlers are the way to go, but I don't see how. I have to bind some .inc into my custom module, is that right? But which of these many .inc files is the one I have to work with and how would I alter it? Or are there other ways to achive what I need?
I think my main question is somewhere in the direction of "How to conditionally hide rewritten fields?" It seems really dificult to fetch these fields along the processing and unset them. Rebuildung the whole view would maybe bring me even more problems, while lots of css goes with the nested markup. I think it would've been much better to have started without fields and with a view mode instead in the very beginning.
node--view--VIEWNAME.tpl.php
template and all of this logic in there.