2021-09-15 15:58:21 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace App\Views\Components\Forms;
|
|
|
|
|
2024-05-29 10:24:13 +00:00
|
|
|
use Override;
|
|
|
|
|
2021-09-15 15:58:21 +00:00
|
|
|
class Textarea extends FormComponent
|
|
|
|
{
|
2024-12-23 15:35:47 +00:00
|
|
|
protected array $attributes = [
|
|
|
|
'rows' => '6',
|
|
|
|
];
|
|
|
|
|
2024-12-19 12:33:57 +00:00
|
|
|
public function setValue(string $value): void
|
2021-09-15 15:58:21 +00:00
|
|
|
{
|
2024-12-19 12:33:57 +00:00
|
|
|
$this->value = htmlspecialchars_decode($value);
|
2021-09-15 15:58:21 +00:00
|
|
|
}
|
|
|
|
|
2024-05-29 10:24:13 +00:00
|
|
|
#[Override]
|
2021-09-15 15:58:21 +00:00
|
|
|
public function render(): string
|
|
|
|
{
|
2024-12-19 12:33:57 +00:00
|
|
|
$this->mergeClass('bg-elevated w-full rounded-lg border-3 border-contrast focus:border-contrast focus-within:ring-accent transition');
|
2021-09-15 15:58:21 +00:00
|
|
|
|
2024-05-09 17:55:41 +00:00
|
|
|
$this->attributes['id'] = $this->id;
|
2021-09-15 15:58:21 +00:00
|
|
|
|
2024-12-19 12:33:57 +00:00
|
|
|
$textarea = form_textarea($this->attributes, $this->getValue());
|
2021-09-15 15:58:21 +00:00
|
|
|
|
|
|
|
return <<<HTML
|
|
|
|
{$textarea}
|
|
|
|
HTML;
|
|
|
|
}
|
|
|
|
}
|