mirror of
https://code.castopod.org/adaures/castopod.git
synced 2024-09-10 20:43:22 +02:00
32 lines
741 B
PHP
32 lines
741 B
PHP
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace App\Views\Components\Forms;
|
||
|
|
||
|
class Textarea extends FormComponent
|
||
|
{
|
||
|
public function setValue(?string $value): void
|
||
|
{
|
||
|
if ($value) {
|
||
|
$this->value = html_entity_decode($value);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public function render(): string
|
||
|
{
|
||
|
unset($this->attributes['value']);
|
||
|
|
||
|
$this->attributes['class'] = 'focus:border-black focus:ring-2 focus:ring-pine-500 focus:ring-offset-2 focus:ring-offset-pine-100 rounded-lg border-3 border-black ' . $this->class;
|
||
|
|
||
|
$textarea = form_textarea(
|
||
|
$this->attributes,
|
||
|
old($this->name, $this->value ?? '', false)
|
||
|
);
|
||
|
|
||
|
return <<<HTML
|
||
|
{$textarea}
|
||
|
HTML;
|
||
|
}
|
||
|
}
|