1 <?php
2
3 /**
4 * This file is part of the Grido (https://github.com/o5/grido)
5 *
6 * Copyright (c) 2011 Petr Bugyík (http://petr.bugyik.cz)
7 *
8 * For the full copyright and license information, please view
9 * the file LICENSE.md that was distributed with this source code.
10 */
11
12 namespace Grido\Components\Filters;
13
14 /**
15 * Select box filter.
16 *
17 * @package Grido
18 * @subpackage Components\Filters
19 * @author Petr Bugyík
20 */
21 class Select extends Filter
22 {
23 /**
24 * @param \Grido\Grid $grid
25 * @param string $name
26 * @param string $label
27 * @param array $items for select
28 */
29 public function __construct($grid, $name, $label, array $items = NULL)
30 {
31 parent::__construct($grid, $name, $label);
32
33 if ($items !== NULL) {
34 $this->getControl()->setItems($items);
35 }
36 }
37
38 /**
39 * @return \Nette\Forms\Controls\SelectBox
40 */
41 protected function getFormControl()
42 {
43 return new \Nette\Forms\Controls\SelectBox($this->label);
44 }
45 }
46