Skip to content

Commit bfb78ce

Browse files
committed
Cloud: display count when summarize is configured
Implements #613
1 parent f0be527 commit bfb78ce

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

meta/AggregationCloud.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ protected function renderTag($result)
8080
"<div style='font-size:$weight%' data-count='$count' class='cloudtag struct_$type'>";
8181
}
8282

83-
$value->renderAsTagCloudLink($this->renderer, $this->mode, $target, $filter, $weight);
83+
$showCount = $this->searchConfig->getConf()['summarize'] ? $count : 0;
84+
$value->renderAsTagCloudLink($this->renderer, $this->mode, $target, $filter, $weight, $showCount);
8485

8586
if ($this->mode == 'xhtml') {
8687
$this->renderer->doc .= '</div>';

meta/Value.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,12 @@ public function render(\Doku_Renderer $R, $mode)
188188
* @param string $page
189189
* @param string $filterQuery
190190
* @param int $weight
191+
* @param int $showCount
191192
*/
192-
public function renderAsTagCloudLink(\Doku_Renderer $R, $mode, $page, $filterQuery, $weight)
193+
public function renderAsTagCloudLink(\Doku_Renderer $R, $mode, $page, $filterQuery, $weight, $showCount)
193194
{
194195
$value = is_array($this->value) ? $this->value[0] : $this->value;
195-
$this->column->getType()->renderTagCloudLink($value, $R, $mode, $page, $filterQuery, $weight);
196+
$this->column->getType()->renderTagCloudLink($value, $R, $mode, $page, $filterQuery, $weight, $showCount);
196197
}
197198

198199
/**

types/AbstractBaseType.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,15 @@ public function renderMultiValue($values, \Doku_Renderer $R, $mode)
350350
* @param string $page the target to which should be linked
351351
* @param string $filter the filter to apply to the aggregations on $page
352352
* @param int $weight the scaled weight of the item. implemented as css font-size on the outside container
353+
* @param int $showCount count for the tag, only passed if summarize was set in config
353354
*/
354-
public function renderTagCloudLink($value, \Doku_Renderer $R, $mode, $page, $filter, $weight)
355+
public function renderTagCloudLink($value, \Doku_Renderer $R, $mode, $page, $filter, $weight, $showCount)
355356
{
356-
$R->internallink("$page?$filter", $this->displayValue($value));
357+
$value = $this->displayValue($value);
358+
if ($showCount) {
359+
$value .= " ($showCount)";
360+
}
361+
$R->internallink("$page?$filter", $value);
357362
}
358363

359364
/**

types/Color.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function valueEditor($name, $rawvalue, $htmlID)
8282
/**
8383
* @inheritDoc
8484
*/
85-
public function renderTagCloudLink($value, \Doku_Renderer $R, $mode, $page, $filter, $weight)
85+
public function renderTagCloudLink($value, \Doku_Renderer $R, $mode, $page, $filter, $weight, $showCount)
8686
{
8787
$color = $this->displayValue($value);
8888
if ($mode == 'xhtml') {

types/Media.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function valueEditor($name, $rawvalue, $htmlID)
121121
/**
122122
* @inheritDoc
123123
*/
124-
public function renderTagCloudLink($value, \Doku_Renderer $R, $mode, $page, $filter, $weight)
124+
public function renderTagCloudLink($value, \Doku_Renderer $R, $mode, $page, $filter, $weight, $showCount)
125125
{
126126
$media = $this->displayValue($value);
127127
if ($mode == 'xhtml' && $this->getConfig()['mime'] == 'image/') {

0 commit comments

Comments
 (0)