2

First time building a custom control panel dashboard for a module.

Template loads ok but is unstyled and not loading JS that the rest of the control panel screens do.

{% extends "_layouts/cp" %}
{% set title = "Dashboard"|t %}

{% block content %}
    hello
{% endblock %}

what have I missed from https://craftcms.com/docs/4.x/extend/cp-templates.html#page-templates

the controller for this looks like

return Craft::$app->view->renderTemplate('module/cp/charges/index');
1
  • 1
    props to Leevi Graham who suggested doing return $this->asCpScreen() ->title('Charges') ->contentTemplate('module/cp/charges/index'); and works fine. Dec 13, 2022 at 9:52

1 Answer 1

3

Consider using:

return $this->asCpScreen()
            ->title('dashboard')
            ->contentTemplate('startupstirling/cp/charges/index');

removing blocks from your template so it's just the content:

hello

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.