mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 18:21:39 +09:00
Improve backward compatibility with legacy |@| encoding
This commit is contained in:
parent
460736c04d
commit
d0f0d7205d
1 changed files with 18 additions and 2 deletions
|
|
@ -236,8 +236,22 @@ class Value
|
||||||
*/
|
*/
|
||||||
public function validate($value): ?BaseObject
|
public function validate($value): ?BaseObject
|
||||||
{
|
{
|
||||||
$is_array = is_array($value);
|
// Take legacy encoding into consideration.
|
||||||
$values = is_array($value) ? $value : [$value];
|
if (is_array($value))
|
||||||
|
{
|
||||||
|
$is_array = true;
|
||||||
|
$values = $value;
|
||||||
|
}
|
||||||
|
elseif (str_contains($value, '|@|'))
|
||||||
|
{
|
||||||
|
$is_array = true;
|
||||||
|
$values = explode('|@|', $value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$is_array = false;
|
||||||
|
$values = [$value];
|
||||||
|
}
|
||||||
|
|
||||||
// Check if a required value is empty.
|
// Check if a required value is empty.
|
||||||
if ($this->is_required === 'Y')
|
if ($this->is_required === 'Y')
|
||||||
|
|
@ -355,10 +369,12 @@ class Value
|
||||||
{
|
{
|
||||||
$values = explode('|@|', $value);
|
$values = explode('|@|', $value);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
elseif (str_contains($value, ',') && $type !== 'kr_zip')
|
elseif (str_contains($value, ',') && $type !== 'kr_zip')
|
||||||
{
|
{
|
||||||
$values = explode(',', $value);
|
$values = explode(',', $value);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$values = [$value];
|
$values = [$value];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue