mirror of
https://code.castopod.org/adaures/castopod.git
synced 2024-10-06 16:37:03 +02:00
94872f2338
- replace some helper components and forms with class components in the ui - create viewcomponents service and load the component function to be used in views
32 lines
655 B
PHP
32 lines
655 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\View\Components\Forms;
|
|
|
|
use ViewComponents\Component;
|
|
|
|
class MultiSelect extends Component
|
|
{
|
|
/**
|
|
* @var array<string, string>
|
|
*/
|
|
protected array $options = [];
|
|
|
|
/**
|
|
* @var string[]
|
|
*/
|
|
protected array $selected = [];
|
|
|
|
public function render(): string
|
|
{
|
|
$defaultAttributes = [
|
|
'data-class' => $this->attributes['class'],
|
|
'multiple' => 'multiple',
|
|
];
|
|
$extra = array_merge($defaultAttributes, $this->attributes);
|
|
|
|
return form_dropdown($this->attributes['name'], $this->options, $this->selected, $extra);
|
|
}
|
|
}
|