Skip to content

Commit 4278c45

Browse files
authored
Merge pull request #686 from cosmocode/jump
Add anchor to agrregations and dynamic filters
2 parents 2a56ec6 + 4b00515 commit 4278c45

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

meta/Aggregation.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ public function startScope()
119119
{
120120
if ($this->mode == 'xhtml') {
121121
$classes = $this->getScopeClasses();
122-
$this->renderer->doc .= '<div class="' . implode(' ', $classes) . '">';
122+
123+
$hash = $this->renderer->info['struct_table_hash'] ?? '';
124+
$id = $hash ? " id=\"$hash\" " : '';
125+
126+
$this->renderer->doc .= '<div ' . $id . 'class="' . implode(' ', $classes) . '">';
123127
}
124128
}
125129

meta/AggregationEditorTable.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public function render($showNotFound = false)
2828
public function startScope()
2929
{
3030
// unique identifier for this aggregation
31-
$this->renderer->info['struct_table_hash'] = md5(var_export($this->data, true));
31+
$hash = md5(var_export($this->data, true));
32+
$this->renderer->info['struct_table_hash'] = $hash;
3233

3334
if ($this->mode != 'xhtml') return;
3435

@@ -42,11 +43,9 @@ public function startScope()
4243
$classes = $this->getScopeClasses();
4344
$classes[] = 'structaggregationeditor';
4445
$classes = implode(' ', $classes);
45-
$this->renderer->doc .= "<div class=\"$classes\"
46+
$this->renderer->doc .= "<div id=\"$hash\"
47+
class=\"$classes\"
4648
data-schema=\"$table\" data-searchconf=\"$config\">";
47-
48-
// unique identifier for this aggregation
49-
$this->renderer->info['struct_table_hash'] = md5(var_export($this->data, true));
5049
}
5150

5251
/**

meta/AggregationTable.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,12 @@ protected function renderDynamicFilters()
281281
$this->renderer->doc .= '<th>';
282282

283283
// BEGIN FORM
284-
$form = new \Doku_Form(['method' => 'GET', 'action' => wl($this->id)]);
284+
$form = new \Doku_Form(
285+
[
286+
'method' => 'GET',
287+
'action' => wl($this->id, $this->renderer->info['struct_table_hash'], false, '#')
288+
]
289+
);
285290
unset($form->_hidden['sectok']); // we don't need it here
286291
if (!$conf['userewrite']) $form->addHidden('id', $this->id);
287292

0 commit comments

Comments
 (0)