1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace Icybee\Element;
13
14 class Group extends \Brickrouge\Group
15 {
16 public function __construct(array $attributes=array())
17 {
18 parent::__construct($attributes);
19
20 $this->tag_name = 'div';
21 $this->add_class('group');
22 $this->add_class('clearfix');
23 }
24
25 protected function render_group_legend($legend)
26 {
27 return '<div class="group-legend">' . $legend . '</div>';
28 }
29
30 31 32 33
34 protected function render_class(array $class_names)
35 {
36 if (!empty($class_names['group-toggler']))
37 {
38 foreach ($this->children as $child)
39 {
40 if ($child->tag_name == 'input' && $child['type'] == 'checkbox')
41 {
42 if ($child['checked'])
43 {
44 $class_names['enabled'] = true;
45
46 break;
47 }
48 }
49 }
50 }
51
52 return parent::render_class($class_names);
53 }
54 }