Jerry
April 2, 2020, 8:07am
1
Hi,
I am trying to create a custom module that uses templates, like the stock module or the currencies module.
The problem is, I can’t get my code to see the templates that are available.
If I look at the code and use “templatesAvailable()” it seems it will look into the modules folder and not in the custom folder.
Is there a way to overrule this, so it will look in /custom/myModule/myModule?
Thank you in advance!
dan
April 7, 2020, 2:29pm
2
Hi there,
Actually there doesn’t appear to be a way to do that - you’d have to copy templatesAvailable()
into your module and override it.
You could then change the folder it looks in to whatever is appropriate for your module.
Best wishes,
Dan
Jerry
April 7, 2020, 5:58pm
3
Hi Dan,
Thanks for the update! I was allready looking in that direction, but was wondering if I overlooked something.
Going to give it a go tomorrow.
Jerry
1 Like
dan
April 9, 2020, 7:00am
4
If you wanted to PR into the main project instead, I am sure we would accept a contribution which allowed someone to call a new method setTemplatePath()
when the module was initialised - seems like sensible functionality.
I made an issue for it anyway as it would be good for us to address it at some point:
opened 07:00AM - 09 Apr 20 UTC
The path is hard-coded to modules/
Jerry
April 9, 2020, 10:48am
5
Hi Dan, that’s great!
For now I have included the function myself and that seems to work. (Only the preview thumnails not yet, but I’m looking into that.)
Thanks for the update.
1 Like