castopod/app/Views/Components/Forms/ColorRadioButton.php
Yassine Doghri 1d1490b06a feat(video-clips): add new themes + add castopod logo as a watermark
fix video colors to portray exact rgb values using libx264rgb encoding + image transparency issue
when overlaying images with php gd
2021-12-29 12:09:32 +00:00

38 lines
914 B
PHP

<?php
declare(strict_types=1);
namespace App\Views\Components\Forms;
class ColorRadioButton extends FormComponent
{
protected bool $isChecked = false;
protected string $style = '';
public function setIsChecked(string $value): void
{
$this->isChecked = $value === 'true';
}
public function render(): string
{
$radioInput = form_radio(
[
'id' => $this->value,
'name' => $this->name,
'class' => 'color-radio-btn',
],
$this->value,
old($this->name) ? old($this->name) === $this->value : $this->isChecked,
);
return <<<HTML
<div class="{$this->class}" style="{$this->style}">
{$radioInput}
<label for="{$this->value}" title="{$this->slot}" data-tooltip="bottom"></label>
</div>
HTML;
}
}