diff --git a/src/Layout/AbstractFormLayout.php b/src/Layout/AbstractFormLayout.php index e833017..00f0b6c 100644 --- a/src/Layout/AbstractFormLayout.php +++ b/src/Layout/AbstractFormLayout.php @@ -14,6 +14,7 @@ use function array_key_exists; use function gettype; use function in_array; +use function is_string; abstract class AbstractFormLayout implements FormLayout { @@ -223,14 +224,16 @@ private function addConfiguredAttributes(Widget $widget, Attributes $attributes) } foreach ($this->widgetConfig[$type]['attributes'] as $attribute => $key) { - switch (gettype($key)) { - case 'array': - $attributes->setAttribute($attribute, $this->parseArrayAttributeConfig($widget, $key)); - break; + $value = match(gettype($key)) { + 'array' => $this->parseArrayAttributeConfig($widget, $key), + default => $widget->$key, + }; - default: - $attributes->setAttribute($attribute, $widget->$key); + if (is_string($value)) { + $value = StringUtil::decodeEntities($value); } + + $attributes->setAttribute($attribute, $value); } } @@ -250,6 +253,10 @@ private function parseWidgetAttributes(Widget $widget, Attributes $attributes): if (in_array($name, static::$booleanAttributes)) { $attributes->setAttribute($name, true); } elseif ($value !== '') { + if (is_string($value)) { + $value = StringUtil::decodeEntities($value); + } + $attributes->setAttribute($name, $value); } }