Reputation: 1199
I'm using Unclecheese dashboard module. Now I'm trying to overload (? I think that's the right englisch term)
the Dashboard_Content.ss template. To do so I copied it contents into a new file with the same name in the "Includes" folder under my module directory. Made my changes and saved.
After flushing nothing happens, but if I place the same template file under mysite/templates/Includes instead of mymodule/templates/Includes it works as expected ...
Even if I delete the original template file out of the dashboard folder, the file in my module folder get's not recognized.
My next try was extending the Dashboard and render it with another template
<?php
class CSYMDashboardExtension extends DataExtension {
public function init() {
$config = SiteConfig::current_site_config();
if(!$config->CompanyID || !$config->CompanyOwner || !$config->Bank || !$config->IBAN || !$config->BIC || !$config->UstID || !$config->SenderEmail) {
return $this->owner
->customise(
['Message' => 'Die Einrichtung ist noch nicht komplett abgeschlossen! Wird das System in diesem Zustand verwendet werden Fehler auftreten! Bitte setzen Sie die Einrichtung hier fort <a href="/admin/settings/">Einstellungen</a>']
)->renderWith(['DCTest']);
}
}
}
But that doesn't work, no matter where the template file is located (I also tried onAfterInit()
.
In my modules config.yml I've declared it to load after framework and cms After: 'framework/*','cms/*'
Does anyone have a solution for this problem?
Edit: as a little side note, I've had a similar problem while overloading the UploadField_FileButtons.ss template. This was also not recognized until I changed the "Includes"-Folder to "includes". But for the dashboard case it doesn't work both ways.
Upvotes: 2
Views: 79
Reputation: 111
A module template will have difficulty overriding another module's template (if that's even possible..?)
I'd suggest you override the template in a theme-module specific <current_theme>_dashboard
folder and have that in a similar structure to what you have at the moment.
So in the end, your file would be in:
themes/templates/<current_theme>_dashboard/includes/Dashboard_Content.ss
Reference: https://docs.silverstripe.org/en/3.2/developer_guides/templates/template_inheritance
Upvotes: 2