forked from VisualAppeal/YiiBootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EBootstrapModalTrigger.php
59 lines (50 loc) · 1021 Bytes
/
EBootstrapModalTrigger.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* Triggers a {link @EBootstrapModal}
* http://twitter.github.com/bootstrap/javascript.html#modals
*
* @author Tim Helfensdörfer <tim@visualappeal.de>
* @version 0.3.7
* @package bootstrap.widgets
*/
class EBootstrapModalTrigger extends EBootstrapWidget {
/**
* Kind of HTML element
*/
public $element = 'a';
/**
* Value of the HTML element
*/
public $value = 'Show Modal';
/**
* Use a custom HTML trigger, if it's set to false, the element/value is used
*/
public $html = false;
/**
* ID of EBootstrapModal
*/
public $modal = '#';
/**
* Init widget
*/
public function init() {
parent::init();
if ($this->html === false) {
$this->htmlOptions['data-toggle'] = 'modal';
$this->htmlOptions['href'] = '#'.$this->modal;
}
}
/**
* Render trigger
*/
public function run() {
parent::run();
if ($this->html === false) {
echo EBootstrap::tag($this->element, $this->htmlOptions, $this->value);
}
else {
echo $this->html;
}
}
}
?>