Skip to content

Commit a204b16

Browse files
authored
Merge pull request #565 from fschrempf/aggregation-table-render-event
Add an event for custom aggregation table rendering
2 parents ca94dee + 844a4f0 commit a204b16

File tree

1 file changed

+35
-5
lines changed

1 file changed

+35
-5
lines changed

meta/AggregationTable.php

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace dokuwiki\plugin\struct\meta;
44

5+
use dokuwiki\Extension\Event;
6+
57
/**
68
* Creates the table aggregation output
79
*
@@ -92,6 +94,14 @@ public function __construct($id, $mode, \Doku_Renderer $renderer, SearchConfig $
9294
$this->helper = plugin_load('helper', 'struct_config');
9395
}
9496

97+
/**
98+
* Returns the page id for the table
99+
*/
100+
public function getID()
101+
{
102+
return $this->id;
103+
}
104+
95105
/**
96106
* Create the table on the renderer
97107
*/
@@ -106,9 +116,33 @@ public function render()
106116
return;
107117
}
108118

109-
// table open
110119
$this->startScope();
111120
$this->renderActiveFilters();
121+
122+
$rendercontext = array(
123+
'table' => $this,
124+
'renderer' => $this->renderer,
125+
'search' => $this->searchConfig,
126+
'columns' => $this->columns,
127+
'data' => $this->result
128+
);
129+
130+
Event::createAndTrigger(
131+
'PLUGIN_STRUCT_RENDER_AGGREGATION_TABLE',
132+
$rendercontext,
133+
array($this, 'renderTable')
134+
);
135+
136+
// export handle
137+
$this->renderExportControls();
138+
$this->finishScope();
139+
}
140+
141+
/**
142+
* Render the default aggregation table
143+
*/
144+
public function renderTable($rendercontext)
145+
{
112146
$this->renderer->table_open();
113147

114148
// header
@@ -135,10 +169,6 @@ public function render()
135169

136170
// table close
137171
$this->renderer->table_close();
138-
139-
// export handle
140-
$this->renderExportControls();
141-
$this->finishScope();
142172
}
143173

144174
/**

0 commit comments

Comments
 (0)