@@ -116,7 +116,7 @@ class Dashboard extends Process implements Module
116116 'headline_without_user' => $this->_('Welcome'),
117117 'panel_not_found' => $this->_('Dashboard panel not found: %s'),
118118 'empty_panel_notice' => $this->_('Your dashboard is empty'),
119- 'setup_hint' => $this->sanitizer->entitiesMarkdown(
119+ 'setup_hint' => $this->wire()-> sanitizer->entitiesMarkdown(
120120 $this->_('Learn how to add and configure panels reading the [documentation](%s).')
121121 ),
122122 'get_started' => $this->_('Get started'),
@@ -174,19 +174,17 @@ class Dashboard extends Process implements Module
174174 protected function addUserNavItem()
175175 {
176176 $this->addHookAfter('AdminThemeFramework::getUserNavArray', function ($event) {
177- $navArray = $event->return;
178-
179177 $page = $this->getDashboardPageInNav() ?: $this->getDashboardPage();
180178 if ($page && $page->viewable) {
181179 $icon = $this->modules->getModuleInfoProperty($this, 'icon');
182- array_unshift($navArray, [
180+ $nav = $event->return;
181+ array_unshift($nav, [
183182 'url' => $page->url,
184183 'title' => $this->texts->usernav,
185184 'icon' => $icon,
186185 ]);
186+ $event->return = $nav;
187187 }
188-
189- $event->return = $navArray;
190188 });
191189 }
192190
@@ -195,7 +193,7 @@ class Dashboard extends Process implements Module
195193 */
196194 protected function getDashboardPage()
197195 {
198- $admin = $this->pages->get(2 );
196+ $admin = $this->wire()-> pages->get($this->wire()->config->adminRootPageID );
199197 $children = $admin->children('include=hidden, check_access=0');
200198
201199 return $admin->and($children)->get("process={$this}");
@@ -206,7 +204,7 @@ class Dashboard extends Process implements Module
206204 */
207205 protected function getDashboardPageInNav()
208206 {
209- $admin = $this->pages->get(2 );
207+ $admin = $this->wire()-> pages->get($this->wire()->config->adminRootPageID );
210208 $pages = $admin->children('check_access=0');
211209
212210 return $pages->get("process={$this}");
@@ -218,7 +216,7 @@ class Dashboard extends Process implements Module
218216 public function ___execute()
219217 {
220218 // Redirect admin homepage to process page if in navigation
221- if ($this->page->id === 2 ) {
219+ if ($this->page->id === $this->wire()->config->adminRootPageID ) {
222220 $page = $this->getDashboardPageInNav();
223221 if ($page) {
224222 $this->session->redirect($page->url);
@@ -399,7 +397,7 @@ class Dashboard extends Process implements Module
399397 */
400398 private function getPanelClassName($name)
401399 {
402- $panelName = $this->sanitizer() ->pascalCase($name);
400+ $panelName = $this->wire()->sanitizer ->pascalCase($name);
403401
404402 return self::panelModulePrefix.$panelName;
405403 }
@@ -409,10 +407,10 @@ class Dashboard extends Process implements Module
409407 */
410408 public function sanitizePanelSize($input)
411409 {
412- $size = $this->sanitizer->option($input, self::panelSizes);
410+ $size = $this->wire()-> sanitizer->option($input, self::panelSizes);
413411 if (!$size) {
414412 $default = $this->settings->defaultPanelSize;
415- $size = $this->sanitizer->option($default, self::panelSizes);
413+ $size = $this->wire()-> sanitizer->option($default, self::panelSizes);
416414 }
417415
418416 return $size ?: self::fallbackPanelSize;
@@ -554,7 +552,7 @@ class Dashboard extends Process implements Module
554552 parent::___install();
555553 if ($this->installOnHomepage) {
556554 // Set the admin process to use this module
557- $admin = $this->pages->get(2 );
555+ $admin = $this->wire()-> pages->get($this->wire()->config->adminRootPageID );
558556 $admin->process = $this;
559557 $admin->save();
560558 }
@@ -572,7 +570,7 @@ class Dashboard extends Process implements Module
572570 parent::___uninstall();
573571 if ($this->installOnHomepage) {
574572 // Restore the admin process to use ProcessHome again
575- $admin = $this->pages->get(2 );
573+ $admin = $this->wire()-> pages->get($this->wire()->config->adminRootPageID );
576574 $admin->process = 'ProcessHome';
577575 $admin->save();
578576 }
0 commit comments