@@ 14-50 (lines=37) @@ | ||
11 | use Zend\Filter\StringTrim; |
|
12 | use Zend\Filter\StripTags; |
|
13 | ||
14 | class Text extends FieldAbstract |
|
15 | { |
|
16 | /** |
|
17 | * @return string |
|
18 | */ |
|
19 | public function getTag() |
|
20 | { |
|
21 | return 'input'; |
|
22 | } |
|
23 | ||
24 | ||
25 | public function init() |
|
26 | { |
|
27 | $this->setAttribute('type', 'text'); |
|
28 | $this->setAttribute('class', 'form-control'); |
|
29 | $stringTrim = new FilterAdapterZf(new StringTrim()); |
|
30 | $stripTags = new FilterAdapterZf(new StripTags()); |
|
31 | $this->addFilter($stringTrim) |
|
32 | ->addFilter($stripTags); |
|
33 | } |
|
34 | ||
35 | /** |
|
36 | * @return string |
|
37 | */ |
|
38 | public function getPlaceholder() |
|
39 | { |
|
40 | return $this->getAttribute('placeholder'); |
|
41 | } |
|
42 | ||
43 | /** |
|
44 | * @param string $placeholder |
|
45 | */ |
|
46 | public function setPlaceholder($placeholder) |
|
47 | { |
|
48 | $this->setAttribute('placeholder', $placeholder); |
|
49 | } |
|
50 | } |
@@ 15-52 (lines=38) @@ | ||
12 | use Zend\Filter\StringTrim; |
|
13 | use Zend\Filter\StripTags; |
|
14 | ||
15 | class TextArea extends FieldAbstract |
|
16 | { |
|
17 | /** |
|
18 | * @return string |
|
19 | */ |
|
20 | public function getTag() |
|
21 | { |
|
22 | return 'textarea'; |
|
23 | } |
|
24 | ||
25 | ||
26 | public function init() |
|
27 | { |
|
28 | $this->setAttribute('type', 'text'); |
|
29 | $this->setAttribute('class', 'form-control'); |
|
30 | $stringTrim = new FilterAdapterZf(new StringTrim()); |
|
31 | $stripTags = new FilterAdapterZf(new StripTags()); |
|
32 | $this->addFilter($stringTrim) |
|
33 | ->addFilter($stripTags); |
|
34 | $this->setRenderer(new TextAreaRender()); |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * @return string |
|
39 | */ |
|
40 | public function getPlaceholder() |
|
41 | { |
|
42 | return $this->getAttribute('placeholder'); |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @param string $placeholder |
|
47 | */ |
|
48 | public function setPlaceholder($placeholder) |
|
49 | { |
|
50 | $this->setAttribute('placeholder', $placeholder); |
|
51 | } |
|
52 | } |