-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathTreeFilterInput.php
48 lines (38 loc) · 1.18 KB
/
TreeFilterInput.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* User: execut
* Date: 20.11.15
* Time: 11:45
*/
namespace execut\widget;
use execut\yii\jui\Widget;
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
class TreeFilterInput extends Widget
{
/**
* @var string target TreeView widget id
*/
public $treeViewId;
/**
* @var array Html options for search input tag
*/
public $inputOptions = [];
/**
* @var array Html options for clear search button tag
*/
public $clearButtonOptions = [];
public function run() {
$this->clientOptions['treeViewId'] = $this->treeViewId;
$this->registerWidget();
\yii\helpers\Html::addCssClass($this->options, 'execut-tree-filter-input');
$inputOptions = $this->inputOptions;
Html::addCssClass($inputOptions, 'form-control');
$inputOptions['autocomplete'] = 'off';
$clearButtonOptions = ArrayHelper::merge([
'class' => 'close glyphicon glyphicon-search',
'title' => 'Clear search results',
], $this->clearButtonOptions);
echo $this->_renderContainer(Html::input('text', 'search', null, $inputOptions) . Html::tag('span', '', $clearButtonOptions));
}
}