Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I have a straightforward question I wanted Views to return
"What Tags are currently in use by content type X"
I started with a view of all Tags and then looked for how to filter. > No options for content type X, so used relationships BUT this then removed terms that did not use content type X BUT gave me a listing for every node.
In the past I have taken lists like this and altered it at template stage e.g.
<?php
global $venues;
$temp = array();
$phones = array();
$print = false;
foreach($row->field_field_venue as $key => $venue){
if(!isset($venues[$venue['rendered']['#markup']])){
$temp[$key] = $venue['rendered']['#markup'];
$venues[$venue['rendered']['#markup']] = $venue['rendered']['#markup'];
$print = true;
}
}
if($print){
foreach($row->field_field_phone as $key => $phone){
$phones[$temp[$key]] = $phone['rendered']['#markup'];
}
foreach($temp as $key => $venue){
print "<div class='venue-title'>" . $venue . "</div>";
print "<div class='venue-phone'>" . $phones[$venue] . "</div>";
}
}
?>
but I presume I am just missing a more elegant way of doing this within views
Comments
Comment #1
MustangGB CreditAttribution: MustangGB commented