Files
picea-ui/src/Form/UiTextarea.php
T

40 lines
930 B
PHP

<?php
namespace Picea\Ui\Form;
class UiTextarea extends UiInput {
public array $tokens = [ "ui:textarea" ];
public array $attributes = [
'class' => "ui-textarea",
];
public array $options = [];
protected bool $echoRaw = false;
public function __construct(
public string $tag = "textarea",
public bool $raw = false,
) {}
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);
}
protected function echoRaw(bool $value) : self
{
$this->echoRaw = $value;
return $this;
}
}