2021-08-19 14:00:14 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2021-09-02 16:34:25 +00:00
|
|
|
namespace App\Views\Components\Forms;
|
2021-08-19 14:00:14 +00:00
|
|
|
|
2021-09-15 15:58:21 +00:00
|
|
|
class XMLEditor extends FormComponent
|
2021-08-19 14:00:14 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var array<string, string>
|
|
|
|
*/
|
|
|
|
protected array $attributes = [
|
2023-06-12 14:47:38 +00:00
|
|
|
'rows' => '5',
|
2021-08-19 14:00:14 +00:00
|
|
|
'class' => 'textarea',
|
|
|
|
];
|
|
|
|
|
2022-01-23 16:53:23 +00:00
|
|
|
protected string $content = '';
|
|
|
|
|
|
|
|
public function setContent(string $value): void
|
|
|
|
{
|
|
|
|
$this->content = htmlspecialchars_decode($value);
|
|
|
|
}
|
|
|
|
|
2021-08-19 14:00:14 +00:00
|
|
|
public function render(): string
|
|
|
|
{
|
2021-08-27 10:58:22 +00:00
|
|
|
$this->attributes['slot'] = 'textarea';
|
2022-01-23 16:53:23 +00:00
|
|
|
$textarea = form_textarea($this->attributes, $this->content);
|
2021-08-19 14:00:14 +00:00
|
|
|
|
2021-08-27 10:58:22 +00:00
|
|
|
return <<<HTML
|
2021-08-19 14:00:14 +00:00
|
|
|
<xml-editor>{$textarea}</time-ago>
|
2021-08-27 10:58:22 +00:00
|
|
|
HTML;
|
2021-08-19 14:00:14 +00:00
|
|
|
}
|
|
|
|
}
|