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
|
|
|
|
{
|
|
|
|
public function setValue(?string $value): void
|
|
|
|
{
|
|
|
|
if ($value) {
|
2022-01-05 14:58:53 +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-05-09 17:55:41 +00:00
|
|
|
$this->mergeClass('bg-elevated w-full rounded-lg border-3 border-contrast focus:border-contrast focus-within:ring-accent');
|
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
|
|
|
|
|
|
|
$textarea = form_textarea(
|
|
|
|
$this->attributes,
|
|
|
|
old($this->name, $this->value ?? '', false)
|
|
|
|
);
|
|
|
|
|
|
|
|
return <<<HTML
|
|
|
|
{$textarea}
|
|
|
|
HTML;
|
|
|
|
}
|
|
|
|
}
|