castopod/app/Views/Components/Forms/Select.php
Yassine Doghri 7a276764e6 feat(themes): add ViewThemes library to set views in root themes folder
app, admin, install and authentication views are now located in root themes/ folder
2021-12-29 11:54:52 +00:00

32 lines
656 B
PHP

<?php
declare(strict_types=1);
namespace App\Views\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);
}
}