-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathblock_simplehtml.php
More file actions
41 lines (30 loc) · 819 Bytes
/
block_simplehtml.php
File metadata and controls
41 lines (30 loc) · 819 Bytes
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
<?php
class block_simplehtml extends block_base {
public function init() {
$this->title = get_string('simplehtml', 'block_simplehtml');
}
// The PHP tag and the curly bracket for the class definition
// will only be closed after there is another function added in the next section.
public function get_content() {
if ($this->content !== null) {
return $this->content;
}
$this->content = new stdClass;
ob_start();
?>
<h1>Ini adalah block</h1>
<span>
<?php
if (! empty($this->config->text)) {
echo $this->config->text;
}
?>
</span>
<?php
$output = ob_get_contents();
ob_end_clean();
$this->content->text = $output;
$this->content->footer = 'Footer here...';
return $this->content;
}
}