From 59fc41a5b9b1954144462c69ef4423602854d0a6 Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 7 Nov 2016 09:22:33 -0700 Subject: [PATCH] Customfields required bugs - Load attributes from modifications array, were previously ignored - Remove double required check, actual field widget should handle it --- api/src/Etemplate/Widget/Customfields.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/api/src/Etemplate/Widget/Customfields.php b/api/src/Etemplate/Widget/Customfields.php index f0387f60e3..5d5b55acf5 100644 --- a/api/src/Etemplate/Widget/Customfields.php +++ b/api/src/Etemplate/Widget/Customfields.php @@ -278,10 +278,12 @@ class Customfields extends Transformer $type = 'link-to'; } } - $widget = self::factory($type, '<'.$type.' type="'.$type.'" id="'.self::$prefix.$fname.'"/>', self::$prefix.$fname); + $xml = '<'.$type.' type="'.$type.'" id="'.self::$prefix.$fname.'"/>'; + $widget = self::factory($type, $xml, self::$prefix.$fname); $widget->id = self::$prefix.$fname; $widget->attrs['type'] = $type; - + $widget->set_attrs($xml); + // some type-specific (default) attributes switch($type) { @@ -394,10 +396,6 @@ class Customfields extends Transformer // widget has no validate method, eg. is only displaying stuff --> nothing to validate if (!method_exists($widget, 'validate')) continue; $widget->validate($form_name != self::GLOBAL_ID ? $form_name : $cname, $expand, $content, $validated); - if ($field_settings['needed'] && (is_array($value) ? !$value : (string)$value === '')) - { - self::set_validation_error($field,lang('Field must not be empty !!!'),''); - } $field_name = $this->id[0] == self::$prefix && $customfields[substr($this->id,1)] ? $this->id : self::form_name($form_name != self::GLOBAL_ID ? $form_name : $cname, $field); $valid =& self::get_array($validated, $field_name, true);