Skip to content

Commit 62ab667

Browse files
committed
Attempt to fix multi value handling with placeholders
This partly reverts and augments 131fd50 The validator call is needed to transform the given value into to proper format (eg. an array for multivalues or an array of array for multi-page values). This has to be done after applying place holders. This might also fix #729 It might also break other usecase so it needs more real world testing. Overall the bureaucracy handling is a mess, because bureaucracy is a mess. Until splitbrain/dokuwiki-plugin-bureaucracy#303 has been addressed, there is no good way to fix this.
1 parent f4ee6e1 commit 62ab667

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

helper/field.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ protected function setVal($value)
4949
{
5050
if (!$this->column) {
5151
$value = '';
52-
//don't validate placeholders here
53-
} elseif ($this->replace($value) == $value) {
52+
} else {
53+
$value = $this->replace($value);
5454
$validator = new ValueValidator();
5555
$this->error = !$validator->validateValue($this->column, $value);
5656
if ($this->error) {
@@ -158,6 +158,16 @@ public function replacementMultiValueCallback($matches)
158158
*/
159159
protected function createValue()
160160
{
161+
/*
162+
$preparedValue = $this->opt['value'] ?? '';
163+
if($this->column->isMulti()) {
164+
// multi-value fields are treated as comma-separated lists
165+
$preparedValue = explode(',', $preparedValue);
166+
$preparedValue = array_map('trim', $preparedValue);
167+
$preparedValue = array_filter($preparedValue);
168+
}
169+
*/
170+
161171
// input value or appropriately initialized empty value
162172
$preparedValue = $this->opt['value'] ?? ($this->column->isMulti() ? [] : '');
163173

0 commit comments

Comments
 (0)