mirror of
https://code.castopod.org/adaures/castopod.git
synced 2024-09-04 09:57:19 +02:00
- set new colors using the css variables for theming in tailwind.config.js - replace admin and public colors with new variable enabled colors
37 lines
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Views\Components\Forms;
|
|
|
|
class Select extends FormComponent
|
|
{
|
|
/**
|
|
* @var array<string, string>
|
|
*/
|
|
protected array $options = [];
|
|
|
|
protected string $selected = '';
|
|
|
|
public function setOptions(string $value): void
|
|
{
|
|
$this->options = json_decode(html_entity_decode($value), true);
|
|
}
|
|
|
|
public function render(): string
|
|
{
|
|
$defaultAttributes = [
|
|
'class' => 'focus:border-contrast focus:ring-accent border-3 rounded-lg bg-elevated border-contrast ' . $this->class,
|
|
'data-class' => $this->class,
|
|
'data-select-text' => lang('Common.forms.multiSelect.selectText'),
|
|
'data-loading-text' => lang('Common.forms.multiSelect.loadingText'),
|
|
'data-no-results-text' => lang('Common.forms.multiSelect.noResultsText'),
|
|
'data-no-choices-text' => lang('Common.forms.multiSelect.noChoicesText'),
|
|
'data-max-item-text' => lang('Common.forms.multiSelect.maxItemText'),
|
|
];
|
|
$extra = array_merge($this->attributes, $defaultAttributes);
|
|
|
|
return form_dropdown($this->name, $this->options, old($this->name, $this->selected !== '' ? [$this->selected] : []), $extra);
|
|
}
|
|
}
|