1 | <?php |
||
9 | class Template_Service extends Service { |
||
10 | |||
11 | protected $templates = array(); |
||
12 | |||
13 | /** |
||
14 | * Enable template rendering |
||
15 | */ |
||
16 | public function enabled() { |
||
19 | |||
20 | /** |
||
21 | * Disable template rendering |
||
22 | */ |
||
23 | public function disabled() { |
||
26 | |||
27 | /** |
||
28 | * Register a new template. |
||
29 | * |
||
30 | * @param string $name Template name |
||
31 | * @param string $html Template content |
||
32 | */ |
||
33 | 5 | public function add_template( $name, $html ) { |
|
42 | |||
43 | /** |
||
44 | * Get a template by name. |
||
45 | * |
||
46 | * @param string $name Template name |
||
47 | * @return string |
||
48 | */ |
||
49 | 3 | public function get_template( $name ) { |
|
55 | |||
56 | /** |
||
57 | * Get all registered templaes. |
||
58 | * |
||
59 | * @return array |
||
60 | */ |
||
61 | 2 | public function get_templates() { |
|
64 | |||
65 | /** |
||
66 | * Render all registered templates. |
||
67 | */ |
||
68 | 1 | public function render_templates() { |
|
84 | } |
||
85 |