1 <?php
2 3 4 5 6 7 8 9 10
11 namespace uix\ui\control;
12
13 14 15 16 17
18 class autocomplete extends \uix\ui\control\select{
19
20 21 22 23 24 25 26
27 public $type = 'autocomplete';
28
29 30 31 32 33 34
35 protected function enqueue_active_assets(){
36
37 echo '<style type="text/css">';
38 echo '#select2-' . $this->id() . '-control-results .select2-results__option--highlighted[aria-selected] {background-color: ' . $this->base_color() . ';}';
39 echo '</style>';
40
41 }
42
43 44 45 46 47 48 49
50 public function classes() {
51
52 return array(
53 'uix-select2'
54 );
55
56 }
57
58 59 60 61 62 63
64 public function set_assets() {
65
66
67 $this->assets['style']['select2'] = $this->url . 'assets/controls/autocomplete/css/select2' . UIX_ASSET_DEBUG . '.css';
68
69
70 $this->assets['script']['select2'] = array(
71 "src" => $this->url . 'assets/controls/autocomplete/js/select2' . UIX_ASSET_DEBUG . '.js',
72 "in_footer" => true
73 );
74 $this->assets['script']['select2-init'] = array(
75 "src" => $this->url . 'assets/controls/autocomplete/js/select2-init' . UIX_ASSET_DEBUG . '.js',
76 "in_footer" => true
77 );
78
79 parent::set_assets();
80 }
81
82 }