1 <?php
 2 
 3 namespace Balance\Form\Element;
 4 
 5 use Zend\Form\Element\Text;
 6 
 7  8  9 
10 class DateTime extends Text
11 {
12     13 14 
15     public function getAttribute($key)
16     {
17         
18         $value = parent::getAttribute($key);
19         
20         if ($key === 'class') {
21             
22             $classes = array_filter(array_map('trim', explode(' ', $value)));
23             
24             array_unshift($classes, 'form-control-datetimepicker');
25             
26             $classes = array_unique($classes);
27             
28             $value = implode(' ', $classes);
29             
30             $this->setAttribute($key, $value);
31         }
32         
33         return $value;
34     }
35 
36     37 38 
39     public function getOption($option)
40     {
41         
42         $value = parent::getOption($option);
43         
44         if ($option === 'add-on-append' && ! $value) {
45             
46             $value = '<span class="glyphicon glyphicon-calendar"></span>';
47             
48             $this->setOption($option, $value);
49         }
50         
51         return $value;
52     }
53 }
54