mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 09:14:09 +02:00
MultiSelect: add table extension trait
This commit is contained in:
parent
49747c4dca
commit
4f2a53dc90
27
library/Director/Web/Table/Extension/MultiSelect.php
Normal file
27
library/Director/Web/Table/Extension/MultiSelect.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\Web\Table\Extension;
|
||||
|
||||
use ipl\Web\Url;
|
||||
|
||||
// Could also be a static method, MultiSelect::enable($table)
|
||||
trait MultiSelect
|
||||
{
|
||||
protected function enableMultiSelect($url, $sourceUrl, array $keys)
|
||||
{
|
||||
$this->addAttributes([
|
||||
'class' => 'multiselect'
|
||||
]);
|
||||
|
||||
$prefix = 'data-icinga-multiselect';
|
||||
$multi = [
|
||||
"$prefix-url" => Url::fromPath($url),
|
||||
"$prefix-controllers" => Url::fromPath($sourceUrl),
|
||||
"$prefix-data" => implode(',', $keys),
|
||||
];
|
||||
|
||||
$this->addAttributes($multi);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user