Skip to content

Commit ed91d60

Browse files
Only show Tags filter if there are tags to filter by
1 parent 80fc7a2 commit ed91d60

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

web/includes/Filter.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,9 @@ public function simple_widget() {
11351135
#$html .= ($i == 0) ? '' : htmlSelect("filter[Query][terms][$i][cnj]", $conjunctionTypes, $term['cnj']).PHP_EOL;
11361136
$html .= ($i == 0) ? '' : html_input("filter[Query][terms][$i][cnj]", 'hidden', $term['cnj']).PHP_EOL;
11371137
if ( isset($term['attr']) ) {
1138+
if (($term['attr'] == 'Tags') and (count($availableTags)<=1)) {
1139+
continue;
1140+
}
11381141
$html .= '<span class="term '.$term['attr'].'"><span class="term-label-wrapper"><label>'.$attrTypes[$term['attr']].'</label>';
11391142
$html .= html_input("filter[Query][terms][$i][attr]", 'hidden', $term['attr']);
11401143
$html .= html_input("filter[Query][terms][$i][op]", 'hidden', $term['op']).PHP_EOL;
@@ -1160,10 +1163,10 @@ public function simple_widget() {
11601163
// echo '<div style="background-color:lightblue"><pre>selected: '; print_r($selected); echo '</pre></div>';
11611164
// echo '<div style="background-color:green"><pre>options: '; print_r($options); echo '</pre></div>';
11621165

1163-
$html .= '<span class="term-value-wrapper">';
1164-
$html .= htmlSelect("filter[Query][terms][$i][val]", $availableTags, $selected, $options).PHP_EOL;
1165-
$html .= $this->addButtonForFilterSelect("filter[Query][terms][$i][val]");
1166-
$html .= '</span>';
1166+
$html .= '<span class="term-value-wrapper">';
1167+
$html .= htmlSelect("filter[Query][terms][$i][val]", $availableTags, $selected, $options).PHP_EOL;
1168+
$html .= $this->addButtonForFilterSelect("filter[Query][terms][$i][val]");
1169+
$html .= '</span>';
11671170
// $html .= '<span>'.htmlSelect("filter[Query][terms][$i][val]", array_combine($availableTags,$availableTags), $term['val'],
11681171
// $options).'</span>'.PHP_EOL;
11691172
// $html .= '<span>'.htmlSelect("filter[Query][terms][$i][val]", $availableTags, $term['val'], $options).'</span>'.PHP_EOL;
@@ -1173,8 +1176,6 @@ public function simple_widget() {
11731176
// Debug('$selected: '.$selected);
11741177
// Debug('$options: '.$options);
11751178

1176-
1177-
11781179
} else if ( $term['attr'] == 'DateTime' || $term['attr'] == 'StartDateTime' || $term['attr'] == 'EndDateTime') {
11791180
$html .= '<span class="term-value-wrapper">';
11801181
$html .= '<input type="text" class="term-value datetimepicker" name="filter[Query][terms]['.$i.'][val]"';

0 commit comments

Comments
 (0)