You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.markdown
+12-9
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,9 @@ To provide a Dashboard summary screen for users. Dashboard "panels" can contain
14
14
2. Enable it by selecting "Dashboard" in the list, choose Enable from the with-selected menu, then click Apply
15
15
3. Navigate to the Dashboard from the "Dashboard" link in the primary navigation
16
16
17
+
## Setting the Dashboard as the user's default
18
+
19
+
Once installed "Dashboard" will appear in the "Default area" dropdown when you create a new author. If you choose this, the author will be shown the dashboard when they log in.
17
20
18
21
## Core panel types
19
22
@@ -51,19 +54,20 @@ To provide panels your extension needs to implement (subscribe to) three delegat
51
54
52
55
### DashboardPanelTypes
53
56
54
-
The callback function should return the handle and name of your panel(s):
57
+
The callback function should return the handle and name of your panel(s) by adding a new key to the `types` array:
This will create a panel of type `my_dashboard_panel`. Make this name as unique as possible so it doesn't conflict with others.
63
+
This will define a panel of type `my_dashboard_panel`. Make this name as unique as possible so it doesn't conflict with others.
61
64
62
65
### DashboardPanelOptions
63
66
64
-
Each panel has a configuration screen. There are default options for all panels (Label and Position), but you can add additional elements to the configuration form using the `DashboardPanelOptions` delegate:
67
+
Each panel has a configuration screen. There are default options for all panels ("Label" and "Position"), but you can add additional elements to the configuration form using the `DashboardPanelOptions` delegate:
65
68
66
69
public function dashboard_panel_options($context) {
70
+
// make sure it's your own panel type, as this delegate fires for all panel types!
67
71
if ($context['type'] != 'my_dashboard_panel') return;
68
72
69
73
$config = $context['existing_config'];
@@ -78,13 +82,13 @@ Each panel has a configuration screen. There are default options for all panels
78
82
79
83
}
80
84
81
-
The above code creates a fieldset which will be appended to the panel configuration form. The fielset contains a single textfield "Option 1". The `$config` array contains existing saved config, so you can pre-populate your form fields when editing an existing panel.
85
+
The above code creates a fieldset which will be appended to the panel configuration form. The fieldset contains a single textfield with the label "Option 1". The `$config` array contains existing saved options, so you can pre-populate your form fields when editing an existing panel.
82
86
83
-
Upon saving any form fields prefixed with `config`will be saved with this panel instance, and provided to the panel when it renders.
87
+
Upon saving, all form fields named in the `config[...]` array will be saved with this panel instance, and provided to the panel as an array when it renders.
84
88
85
89
### DashboardPanelRender
86
90
87
-
Subscribe to the `DashboardPanelRender` delegate to actually render your panel.
91
+
Subscribe to the `DashboardPanelRender` delegate to render your panel on the dashboard.
88
92
89
93
public function render_panel($context) {
90
94
if ($context['type'] != 'my_dashboard_panel') return;
@@ -93,10 +97,9 @@ Subscribe to the `DashboardPanelRender` delegate to actually render your panel.
93
97
$context['panel']->appendChild(new XMLElement('div', 'The value of Option 1 is: ' . $config['option-1']));
94
98
}
95
99
96
-
First check that you should output your own panel. `$context['panel']` contains an `XMLElement` that is a panel container to which you can append children. The saved configuration for the panel is presented in the `$context['config']` array.
100
+
First check that you should output your own panel. `$context['panel']` contains an `XMLElement` that is an empty panel container to which you can append children. The saved configuration for the panel is presented in the `$context['config']` array.
97
101
98
102
* * *
99
103
100
104
## Known issues
101
-
* when selecting an item from the Create New menu, the menu does not disappear until it loses focus
102
-
* adding more than one Markdown Text Panel produces a PHP error
105
+
* adding Markdown panels using different versions of the Markdown formatter will cause an error. Be sure to always use the same Markdown formatter for all panels
0 commit comments