Skip to content

Attempt to fix multi value handling with placeholders #740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions helper/field.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ protected function setVal($value)
{
if (!$this->column) {
$value = '';
//don't validate placeholders here
} elseif ($this->replace($value) == $value) {
} else {
$value = $this->replace($value);
$validator = new ValueValidator();
$this->error = !$validator->validateValue($this->column, $value);
if ($this->error) {
Expand Down Expand Up @@ -158,6 +158,16 @@ public function replacementMultiValueCallback($matches)
*/
protected function createValue()
{
/*
$preparedValue = $this->opt['value'] ?? '';
if($this->column->isMulti()) {
// multi-value fields are treated as comma-separated lists
$preparedValue = explode(',', $preparedValue);
$preparedValue = array_map('trim', $preparedValue);
$preparedValue = array_filter($preparedValue);
}
*/

// input value or appropriately initialized empty value
$preparedValue = $this->opt['value'] ?? ($this->column->isMulti() ? [] : '');

Expand Down
Loading