- Implemented CSRF check, some bugfixes also included

This commit is contained in:
mcndave committed 2022-02-03 20:06:04 +00:00
1 parent 362184f81f
commit 97f1f67af1
7 files changed
+72 -31

No files matched your search

+21 -2
View File
@@ -4,7 +4,7 @@ namespace Picea\Ui\Form;
class UiTextarea extends UiInput {
public string $token = "ui.textarea";
public array $tokens = [ "ui.textarea", "ui.textarea.raw" ];
public string $tag = "textarea";
@@ -14,8 +14,27 @@ class UiTextarea extends UiInput {
public array $options = [];
protected bool $echoRaw = false;
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) : string
{
if ($token === 'ui.textarea.raw') {
$this->echoRaw = true;
}
return sprintf("<?php echo ( new \\" . static::class . "() )->echoRaw(%s)->buildHtml($arguments) ?>", $this->echoRaw ? 'true' : 'false');
}
protected function setValue($value) : void
{
$this->html($value);
$this->echoRaw ? $this->html($value) : $this->text($value);
}
public function echoRaw(bool $set) : self
{
$this->echoRaw = $set;
return $this;
}
}