diff --git a/src/Form/UiImage.php b/src/Form/UiImage.php index 03f6846..0124d5b 100644 --- a/src/Form/UiImage.php +++ b/src/Form/UiImage.php @@ -11,8 +11,6 @@ class UiImage extends UiElement implements Extension { public array $tokens = [ "ui:img", "ui:image" ]; - public string $tag = "img"; - public array $attributes = [ 'class' => 'ui-image', ]; @@ -21,6 +19,10 @@ class UiImage extends UiElement implements Extension { 'tag-type' => "single", ]; + public function __construct( + public string $tag = "img", + ) {} + public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token, array $options = []) : string { return "buildHtml($arguments) ?>"; diff --git a/src/Form/UiTextarea.php b/src/Form/UiTextarea.php index ab58fa6..3586838 100644 --- a/src/Form/UiTextarea.php +++ b/src/Form/UiTextarea.php @@ -25,9 +25,15 @@ class UiTextarea extends UiInput { return "buildHtml($arguments) ?>"; } - protected function setValue($value) : void { $this->echoRaw ? $this->html($value) : $this->text($value); } + + protected function echoRaw(bool $value) : self + { + $this->echoRaw = $value; + + return $this; + } } diff --git a/src/Method/FormContext.php b/src/Method/FormContext.php index bab16df..7120270 100644 --- a/src/Method/FormContext.php +++ b/src/Method/FormContext.php @@ -38,7 +38,7 @@ class FormContext implements FormContextInterface $this->values = $request->getParsedBody() ?: []; if ( ! $this->values ) { - $content = utf8_encode((string) $request->getBody()); + $content = mb_convert_encoding((string) $request->getBody(), 'UTF-8'); if ( $content && ( $json = json_decode($content, true) ) ) { $this->values = $json;