1 | <?php |
||
13 | class DataScout extends DataComponent { |
||
14 | |||
15 | /** @var string */ |
||
16 | private $_placeholder = 'Search..'; |
||
17 | |||
18 | /** @var DataSearch */ |
||
19 | private $_dataSearch; |
||
20 | |||
21 | /** |
||
22 | * DataScout constructor. |
||
23 | * @param DataSearch $dataSearch |
||
24 | * @param bool $remember |
||
25 | */ |
||
26 | 10 | public function __construct(DataSearch $dataSearch, $remember = false) |
|
32 | |||
33 | /** |
||
34 | * @return Builder |
||
35 | */ |
||
36 | 8 | public function _shapeData() : Builder |
|
45 | |||
46 | /** |
||
47 | * How should the dataset be searched? |
||
48 | * Define the search algorithm, e.g. SimpleSearch or FulltextSearch |
||
49 | * |
||
50 | * @param DataSearch $dataSearch |
||
51 | * @return DataScout |
||
52 | */ |
||
53 | 1 | public function setSearch(DataSearch $dataSearch) : DataScout |
|
59 | |||
60 | /** |
||
61 | * Add a query programmatically. |
||
62 | * |
||
63 | * @param string $query |
||
64 | * @return DataScout |
||
65 | */ |
||
66 | 7 | public function addQuery(string $query) : DataScout |
|
72 | |||
73 | /** |
||
74 | * Set the placeholder for the input. |
||
75 | * |
||
76 | * @param string $text |
||
77 | * @return DataScout |
||
78 | */ |
||
79 | 1 | public function placeholder(string $text) : DataScout |
|
85 | |||
86 | /** |
||
87 | * Make the field searchable. |
||
88 | * |
||
89 | * @param string $field |
||
90 | * @return DataScout |
||
91 | */ |
||
92 | 1 | public function makeSearchable(string $field) : DataScout |
|
98 | |||
99 | /** |
||
100 | * @return string |
||
101 | */ |
||
102 | 1 | public function render() : string |
|
106 | |||
107 | /** |
||
108 | * @return string |
||
109 | */ |
||
110 | 1 | public function getSearchUrl() : string |
|
114 | |||
115 | 9 | protected function _afterInit() : void |
|
123 | } |