Commit 054d5f34 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(simpleplugin): Fix PHP error in readonly mode

When showing multivaluated attributes in readonly (like when showing
 inherited values) it was triggering a PHP error and not working

issue #5730
Showing with 12 additions and 1 deletion
+12 -1
...@@ -560,7 +560,18 @@ class Attribute ...@@ -560,7 +560,18 @@ class Attribute
{ {
if ($this->visible) { if ($this->visible) {
if ($readOnly) { if ($readOnly) {
$input = '{literal}'.htmlentities($this->getValue(), ENT_COMPAT, 'UTF-8').'{/literal}'; $value = $this->getValue();
if (is_array($value)) {
$input = '{literal}'.implode('<br/>', array_map(
function ($v)
{
return htmlentities($v, ENT_COMPAT, 'UTF-8');
},
$value
)).'{/literal}';
} else {
$input = '{literal}'.htmlentities($value, ENT_COMPAT, 'UTF-8').'{/literal}';
}
} elseif (is_object($this->plugin) && $this->plugin->is_template) { } elseif (is_object($this->plugin) && $this->plugin->is_template) {
$input = $this->renderTemplateInput(); $input = $this->renderTemplateInput();
} else { } else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment