Custom module with templates - override templatesAvailable

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!

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

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

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. :smiley:

I made an issue for it anyway as it would be good for us to address it at some point:

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