- Token name and options are now passed through parse() method

This commit is contained in:
mcndave committed 2023-02-02 19:38:20 +00:00
1 parent 77d05ae051
commit aba66479be
12 files changed
+114 -150

No files matched your search

+10 -11
View File
@@ -16,22 +16,21 @@ class UiTextarea extends UiInput {
protected bool $echoRaw = false;
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token) : string
{
$raw = in_array('raw', $context->tokenOptions($token)) ? 'true' : 'false';
public function __construct(
public bool $raw = false
) {
parent::__construct(null);
}
return "<?php echo ( new \\" . static::class . "() )->echoRaw($raw)->buildHtml($arguments) ?>";
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token, array $options = []) : string
{
$raw = in_array('raw', $options) ? 'true' : 'false';
return "<?php echo ( new \\" . static::class . "(raw: $raw) )->buildHtml($arguments) ?>";
}
protected function setValue($value) : void
{
$this->echoRaw ? $this->html($value) : $this->text($value);
}
public function echoRaw(bool $set) : self
{
$this->echoRaw = $set;
return $this;
}
}