1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace Brickrouge;
13
14 class Searchbox extends Element
15 {
16 private $elements=array();
17
18 public function __construct($tags)
19 {
20 parent::__construct
21 (
22 'div', $tags + array
23 (
24 self::CHILDREN => array
25 (
26 'q' => $this->elements['q'] = new Text(),
27
28 $this->elements['trigger'] = new Button
29 (
30 'Search', array
31 (
32 'type' => 'submit'
33 )
34 )
35 ),
36
37 'class' => 'widget-searchbox'
38 )
39 );
40 }
41
42 public function offsetSet($offset, $value)
43 {
44 if (in_array($offset, array('name', 'value', 'placeholder')))
45 {
46 $this->elements['q'][$offset] = $value;
47 }
48
49 return parent::offsetSet($offset, $value);
50 }
51 }