forked from EFTEC/BladeOne
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBladeOneCustom.php
More file actions
54 lines (43 loc) · 1.61 KB
/
BladeOneCustom.php
File metadata and controls
54 lines (43 loc) · 1.61 KB
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
<?php
namespace eftec\bladeone;
/*
* Its an example of a custom set of functions for bladeone.
* in examples/TestCustom.php there is a working example
*
*/
trait BladeOneCustom
{
var $customItem=array(); // indicates the type of the current tag. such as select/selectgroup/etc.
//<editor-fold desc="compile function">
/**
* Usage @panel('title',true,true).....@endpanel()
* @param $expression
* @return string
*/
protected function compilePanel($expression)
{
array_push($this->customItem, 'Panel');
return $this->phpTag . "echo \$this->panel{$expression}; ?>";
}
protected function compileEndPanel() {
$r=@array_pop($this->customItem);
if (is_null($r)) {
$this->showError("@endpanel","Missing @compilepanel or so many @compilepanel",true);
}
return " </div></section><!-- end panel -->"; // we don't need to create a function for this.
}
//</editor-fold>
//<editor-fold desc="used function">
function panel($title="",$toggle=true,$dismiss=true) {
return "<section class='panel'>
<header class='panel-heading'>
<div class='panel-actions'>
".(($toggle)?"<a href='#' class='panel-action panel-action-toggle' data-panel-toggle></a>":"")."
".(($dismiss)?"<a href='#' class='panel-action panel-action-dismiss' data-panel-dismiss></a>":"")."
</div>
<h2 class='panel-title'>$title</h2>
</header>
<div class='panel-body'>";
}
//</editor-fold>
}