Skip to content

Commit

Permalink
Fallback for dashboard widgets in custom manager theme (#16705)
Browse files Browse the repository at this point in the history
### What does it do?
Loads the dashboard widget templates from the default theme, if they
don't exist in the custom manager theme.

### Why is it needed?
The
[documentation](https://docs.modx.com/current/en/building-sites/client-proofing/custom-manager-themes)
states that "The Manager will fall back to the default theme templates
for any that have not been overridden."
This is currently not the case for the dashboard widgets (that load a
Smarty template).

### How to test
* Create a new folder in `manager/templates` for a custom manager theme
and change the system setting `manager_theme`.
* **DON'T** create copies of the files in
`manager/templates/default/dashboard` in your own custom theme folder.
* Make sure the dashboard widgets get displayed on the manager welcome
page.

### Related issue(s)/PR(s)
Related topic in the MODX forum:
https://community.modx.com/t/manager-theme-customization-problem/8261
  • Loading branch information
halftrainedharry authored Feb 14, 2025
1 parent db98407 commit 3c3f759
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion manager/controllers/default/dashboard/widget.buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function render()
$this->modx->smarty->assign($key, $value);
}

return $this->modx->smarty->fetch('dashboard/buttons.tpl');
return $this->controller->fetchTemplate('dashboard/buttons.tpl');
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function render()
$this->modx->getService('smarty', modSmarty::class);
$this->modx->smarty->assign('warnings', $response->getObject());

return $this->modx->smarty->fetch('dashboard/configcheck.tpl');
return $this->controller->fetchTemplate('dashboard/configcheck.tpl');
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function render()
$this->modx->smarty->assign('data', $data);
$this->modx->smarty->assign('can_view_logs', $this->modx->hasPermission('logs'));

return $this->modx->smarty->fetch('dashboard/onlineusers.tpl');
return $this->controller->fetchTemplate('dashboard/onlineusers.tpl');
}
}

Expand Down
2 changes: 1 addition & 1 deletion manager/controllers/default/dashboard/widget.grid-rer.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function render()
$this->modx->smarty->assign('data', $data);
$this->modx->smarty->assign('can_view_logs', $this->modx->hasPermission('logs'));

return $this->modx->smarty->fetch('dashboard/recentlyeditedresources.tpl');
return $this->controller->fetchTemplate('dashboard/recentlyeditedresources.tpl');
}
}

Expand Down
2 changes: 1 addition & 1 deletion manager/controllers/default/dashboard/widget.updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function render()
$this->modx->smarty->assign($key, $value);
}

return $this->modx->smarty->fetch('dashboard/updates.tpl');
return $this->controller->fetchTemplate('dashboard/updates.tpl');
}
}

Expand Down

0 comments on commit 3c3f759

Please sign in to comment.