@@ -37,15 +37,15 @@ class ExampleLayout extends \cornernote\dashboard\Layout
37
37
];
38
38
}
39
39
40
- public function getRegionOpts ()
40
+ public function getRegions ()
41
41
{
42
42
return [
43
43
'column-1' => 'Column 1',
44
44
'column-2' => 'Column 2',
45
45
];
46
46
}
47
47
48
- public function regionPanels($dashboardPanels)
48
+ public function regionPanels($dashboardPanels, $view = 'view' )
49
49
{
50
50
$regionPanels = [
51
51
'column-1' => [],
@@ -58,32 +58,16 @@ class ExampleLayout extends \cornernote\dashboard\Layout
58
58
'id' => 'dashboard-panel-' . $dashboardPanel->id,
59
59
'class' => 'dashboard-panel',
60
60
],
61
- 'content' => $dashboardPanel->panel->renderView( ),
61
+ 'content' => $dashboardPanel->panel->render($view ),
62
62
];
63
63
}
64
64
return $regionPanels;
65
65
}
66
66
67
- public function renderView( )
67
+ public function render($view, $params = [] )
68
68
{
69
- return \Yii::$app->view->render($this->viewPath . '/view', [
70
- 'layout' => $this,
71
- ]);
72
- }
73
-
74
- public function renderUpdate()
75
- {
76
- return \Yii::$app->view->render($this->viewPath . '/update', [
77
- 'layout' => $this,
78
- ]);
79
- }
80
-
81
- public function renderForm($form)
82
- {
83
- return \Yii::$app->view->render($this->viewPath . '/form', [
84
- 'layout' => $this,
85
- 'form' => $form,
86
- ]);
69
+ $params['layout'] = $this;
70
+ return \Yii::$app->view->render($this->viewPath . '/view', $params);
87
71
}
88
72
89
73
}
@@ -131,7 +115,7 @@ Place the following code into `app/views/dashboard/layouts/example/update.php`:
131
115
* @var $this \yii\web\View
132
116
*/
133
117
134
- $regionPanels = $layout->regionPanels($layout->dashboard->getDashboardPanels()->all());
118
+ $regionPanels = $layout->regionPanels($layout->dashboard->getDashboardPanels()->all(), 'update' );
135
119
136
120
echo '<div class =" row" >';
137
121
foreach ($regionPanels as $region => $items) {
0 commit comments