-
Notifications
You must be signed in to change notification settings - Fork 5
/
DashboardPanelHelloWorld.module
executable file
·86 lines (75 loc) · 1.85 KB
/
DashboardPanelHelloWorld.module
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php namespace Daun\Dashboard;
use function ProcessWire\__;
// Include abstract panel base class
require_once dirname(__DIR__).'/Dashboard/DashboardPanel.class.php';
class DashboardPanelHelloWorld extends DashboardPanel
{
public static function getModuleInfo()
{
return array_merge(
parent::getModuleInfo(),
[
'title' => __('Dashboard Panel: Hello World', __FILE__),
'summary' => __('An example dashboard panel', __FILE__),
'author' => 'Philipp Daun',
'version' => '0.0.1',
]
);
}
/**
* Setup the panel: fetch data, do calculations, check for config errors, etc.
*/
public function setup()
{
$this->text = $this->data['text'] ?? 'Nothing to see here';
}
/**
* Get the panel's FontAwesome icon code (without the fa- prefix).
*/
public function getIcon()
{
return 'globe';
}
/**
* Get the panel's title.
*/
public function getTitle()
{
return $this->_('Hello World');
}
/**
* Get the panel's main content.
*/
public function getContent()
{
return "<p>{$this->text}</p>";
}
/**
* Get the panel's footer.
*/
public function getFooter()
{
return $this->_('Goodbye World');
}
/**
* Get a list of additional class names for the panel card.
*/
public function getClassNames()
{
return ['unique-classname-for-styling'];
}
/**
* Get a list of the panel's stylesheets.
*/
public function getStylesheets()
{
return ['https://cdnjs.cloudflare.com/something.min.css'];
}
/**
* Get a list of the panel's script files.
*/
public function getScripts()
{
return ['assets/something.min.js'];
}
}