mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Allow modules to define dashboard groups per layout region.
This commit is contained in:
parent
ae22af2c56
commit
b66f0db401
2 changed files with 36 additions and 1 deletions
|
@ -57,6 +57,40 @@ function hook_farm_dashboard_panes() {
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines farm dashboard groups.
|
||||
*
|
||||
* @return array
|
||||
* Returns an array of farm dashboard groups keyed by layout region.
|
||||
*/
|
||||
function hook_farm_dashboard_groups() {
|
||||
return [
|
||||
|
||||
// Returns an associate array keyed by the layout region.
|
||||
// Options are top, first, second, or bottom.
|
||||
'first' => [
|
||||
|
||||
// Groups are defined as a render array keyed with a unique group
|
||||
// machine name.
|
||||
'my_group' => [
|
||||
|
||||
// The type. Defaults to container.
|
||||
'#type' => 'details',
|
||||
|
||||
// Optionally specify a title.
|
||||
'#title' => t('My group title'),
|
||||
|
||||
// Optionally specify a weight for sorting.
|
||||
'#weight' => 100,
|
||||
],
|
||||
|
||||
],
|
||||
'bottom' => [
|
||||
// Define groups for the bottom layout region.
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup hooks".
|
||||
*/
|
||||
|
|
|
@ -47,7 +47,8 @@ class DashboardController extends ControllerBase {
|
|||
public function dashboard() {
|
||||
|
||||
// Start a build array.
|
||||
$build = [];
|
||||
// Ask modules for dashboard groups.
|
||||
$build = $this->moduleHandler()->invokeAll('farm_dashboard_groups');
|
||||
|
||||
// Ask modules for dashboard panes.
|
||||
$panes = $this->moduleHandler()->invokeAll('farm_dashboard_panes');
|
||||
|
|
Loading…
Reference in a new issue