1 <?php
2
3 /*
4 * This file is part of the Icybee package.
5 *
6 * (c) Olivier Laviale <olivier.laviale@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Icybee\Element;
13
14 use Brickrouge\Element;
15 use Brickrouge\ElementIsEmpty;
16
17 class ActionbarSearch extends Element
18 {
19 public function __construct(array $attributes=array())
20 {
21 parent::__construct('div', $attributes + array('class' => 'actionbar-search'));
22 }
23
24 protected function render_inner_html()
25 {
26 $html = parent::render_inner_html();
27
28 new ActionbarSearch\AlterInnerHTMLEvent($this, array('html' => &$html));
29
30 if (empty($html))
31 {
32 throw new ElementIsEmpty;
33 }
34
35 return $html;
36 }
37 }
38
39 namespace Icybee\Element\ActionbarSearch;
40
41 /**
42 * Event class for the `Icybee\Element\ActionbarSearch::alter_inner_html` event.
43 */
44 class AlterInnerHTMLEvent extends \ICanBoogie\Event
45 {
46 /**
47 * Reference to the rendered inner HTML of the element.
48 *
49 * @var string
50 */
51 public $html;
52
53 /**
54 * The event is constructed with the type `alter_inner_html`.
55 *
56 * @param \Icybee\Element\ActionbarSearch $target
57 * @param array $payload
58 */
59 public function __construct(\Icybee\Element\ActionbarSearch $target, array $payload)
60 {
61 parent::__construct($target, 'alter_inner_html', $payload);
62 }
63 }