Fix customfields did not save

This commit is contained in:
nathan 2023-01-05 10:04:29 -07:00
parent 9a190321c1
commit 578f2fc4b1

View File

@ -434,6 +434,7 @@ class Customfields extends Transformer
$all_readonly = $this->is_readonly($cname, $form_name); $all_readonly = $this->is_readonly($cname, $form_name);
$value_in = self::get_array($content, $form_name); $value_in = self::get_array($content, $form_name);
$use_private = self::expand_name($this->attrs['use-private'] ?? null, 0, 0, '', '', self::$cont);
// if we have no id / use self::GLOBAL_ID, we have to set $value_in in global namespace for regular widgets validation to find // if we have no id / use self::GLOBAL_ID, we have to set $value_in in global namespace for regular widgets validation to find
if (!$this->id) $content = array_merge($content, (array)$value_in); if (!$this->id) $content = array_merge($content, (array)$value_in);
//error_log(__METHOD__."($cname, ...) form_name=$form_name, use-private={$this->attrs['use-private']}, value_in=".array2string($value_in)); //error_log(__METHOD__."($cname, ...) form_name=$form_name, use-private={$this->attrs['use-private']}, value_in=".array2string($value_in));
@ -451,8 +452,8 @@ class Customfields extends Transformer
{ {
$field_settings = $customfields[$fname = substr($field, strlen($this->attrs['prefix']))]; $field_settings = $customfields[$fname = substr($field, strlen($this->attrs['prefix']))];
if ((string)$this->attrs['use-private'] !== '' && // are only (non-)private fields requested if((string)$use_private !== '' && // are only (non-)private fields requested
(boolean)$field_settings['private'] != ($this->attrs['use-private'] != '0')) (boolean)$field_settings['private'] != ($use_private != '0'))
{ {
continue; continue;
} }