From 6b870ec652d1c58cace1a68395a59b071ac1380c Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 13 Apr 2023 16:46:40 -0600 Subject: [PATCH] Api: Fix single custom field with ID = fieldname did not properly load value --- api/src/Etemplate/Widget/Customfields.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/src/Etemplate/Widget/Customfields.php b/api/src/Etemplate/Widget/Customfields.php index a99a0d2887..760f23a8b2 100644 --- a/api/src/Etemplate/Widget/Customfields.php +++ b/api/src/Etemplate/Widget/Customfields.php @@ -195,8 +195,9 @@ class Customfields extends Transformer preg_match($preg = '/'.$this->attrs['prefix'].'([^\]]+)/',$form_name,$matches) && isset($fields[$name=$matches[1]])) { $fields = array($name => $fields[$name]); - $value = array($this->attrs['prefix'].$name => $value); - $form_name = $this->attrs['prefix'].$name; + $value = self::get_array(self::$request->content, $form_name, false, true); + $fields[$name]['value'] = $value; + $form_name = $this->attrs['prefix'] . $name; } if(!is_array($fields)) $fields = array(); @@ -267,7 +268,7 @@ class Customfields extends Transformer $widget = $this->_widget($fname, $field); if(method_exists($widget, 'beforeSendToClient')) { - $widget->beforeSendToClient($this->id == self::GLOBAL_ID ? '' : $this->id, $expand); + $widget->beforeSendToClient($this->id == self::GLOBAL_ID ? '' : $form_name, $expand); } } }