Our client saw the schedule view of DrupalCon Denver's site and wants one of their conference schedule views to look like that:
Obviously we're styling things differently, but what they really want is the track icons to display in the exposed filter and alongside the individual sessions.
Individual Sessions We have a content type called session, and a taxonomy called track. The taxonomy has an image field called track icon (field_track_icon), and there's a term reference field on the session that holds the selected track.
I managed to get the icons to display in the view with the sessions:
View setup -
Preview -
But I need to do some conditional processing - if the field "field_hide_track" on the individual session is true, then don't display track icons (or the value of field_hide_track, obviously.) We have a certain session type that needs to contain all of the choices from the taxonomy (i.e. be associated with all tracks) but do not want it to have a visual indicator. Right now, because they have all the choices, the view displays all of the icons from the taxonomy. It also displays the icon twice if there are multiple speakers, but I think that's because of the way we have things grouped. Basically we want the icon to display before the session number/title line for all sessions that don't have field_hide_track checked.
I've tried custom templates (views-view-fields--at-a-glance-test--page.tpl.php and views-view-field--at-a-glance-test--page.tpl.php, where the view's machine name is at_a_glance_test), but can't figure out how to get the information I need to do the conditional processing. Can someone point me in the right direction?
Exposed filter I have no idea where to start with this one. We're using Better Exposed Filters module to allow checkboxes instead of dropdowns, etc. I already have a views-exposed-form template to handle the background color and font choices, etc. but aside from some kind of horrible hard-coding, I don't know how to get the icons from the taxonomy to display next to the checkboxes. I think I could probably move the css for this into the template file and generate a background property for each taxonomy term that would include the image, but I don't know how to get the image from the taxonomy term field in the context of the views-exposed-form template.
EDIT to add Views PHP code that worked
<?php
if(isset($data->field_field_hide_track[0]['raw']['value'])) {
if($data->field_field_hide_track[0]['raw']['value'] == '0') {
$image_vars = array(
'path' => file_create_url($data->field_field_track_icon[0]["rendered"]["#item"]["uri"]),
'alt' => $data->field_field_track_icon[0]["rendered"]["#item"]["alt"],
'attributes' => array(
'class' => array('session_list_track_logo')
)
);
$track_logo = theme('image', $image_vars);
print "<h3>" . $track_logo . " " . $data->field_field_session_number[0]['raw']['value'] . " | " . $row->title . "</h3>";
}
else {
print "<h3>" . $data->field_field_session_number[0]['raw']['value'] . " | " . $row->title . "</h3>";
}
}
?>