LSattribute & LSattr_html: fix handling current/provided data

This commit is contained in:
Benjamin Renard 2021-03-23 14:27:27 +01:00
parent 3ddc51004f
commit d0397ec41e
2 changed files with 10 additions and 5 deletions

View file

@ -118,7 +118,7 @@ class LSattr_html extends LSlog_staticLoggerClass {
* @retval array The values to be displayed in the LSform * @retval array The values to be displayed in the LSform
**/ **/
public function getFormVal($data) { public function getFormVal($data) {
return $this -> attribute -> getDisplayValue(); return $this -> attribute -> getDisplayValue($data);
} }
/** /**

View file

@ -410,14 +410,19 @@ class LSattribute extends LSlog_staticLoggerClass {
} }
/** /**
* Retourne la valeur a afficher dans le formulaire * Return the form display value
*
* @param[in] $data mixed Custom attribute data (optional, default: current attribute data)
* *
* @author Benjamin Renard <brenard@easter-eggs.com> * @author Benjamin Renard <brenard@easter-eggs.com>
* *
* @retval string La valeur a afficher dans le formulaire. * @retval string The form display value
*/ */
public function getFormVal() { public function getFormVal($data=null) {
return ensureIsArray($this -> html -> getFormVal($this -> data)); if (is_null($data)) {
$data = ($this -> isUpdate()?$this -> updateData:$this -> data);
}
return ensureIsArray($this -> html -> getFormVal($data));
} }
/** /**