Skip to main content
6 events
when toggle format what by license comment
Jul 31, 2014 at 14:26 comment added Tobias Krause Do you use devel module? There is a function dpm() which shows you the content of an array or anything else. Maybe add dpm($vars['view']->result); to your preprocess function to find out how the field looks like when there is content and when there is no content.
Jul 31, 2014 at 12:11 comment added hene So code should check if field has value (content) or not. Any tips?
Jul 31, 2014 at 11:27 comment added hene Hmm, could it be because I use one field to show all content. So I have field which has Rewrite results and then tokens. So it basically loads all fields no matter if they does not have content? Here is my field Rewrite results: <div class="front_tile_overlay"></div><div class="tile_image">[field_image][field_image_2][field_image_3]</div><div class="tile_content"><div class="front_tile_title">[field_tile_title]</div><div class="front_tile_body">[field_text_to_frontpage_box]</div></div>
Jul 31, 2014 at 11:10 comment added hene I got it work by using this, but now it adds same class (has_field) to every row even if field_image has content or does not have : function theme_preprocess_views_view_unformatted(&$vars) { $view = $vars['view']; $rows = $vars['rows']; foreach ($vars['view']->result as $id => $row) { if (isset($row->field_image)) { $vars['classes_array'][$id] = 'has_field'; } else { $vars['classes_array'][$id] = 'has_no_field'; } } }
Jul 31, 2014 at 9:40 comment added hene I'm getting: Fatal error: [] operator not supported for strings in. Any help?
Jul 28, 2014 at 16:43 history answered Tobias Krause CC BY-SA 3.0