I have created a custom global module. It is going to be placed on multiple templates, drag and drop page templates not coded templates. However, I need to do some conditional logic to show/hide based on what page template it’s used on.
All the content in the global module will be the same with the exception of an image. I need to use a specific image on one template but a different one on another. This module is actually pretty complex and has a lot of content. So cloning it for different templates just to set a different image is not preferred because all the other content would have to be re-entered or would have to update each module separately when updating the content.
So basically what I want to do is create two image fields and then display one or the other depending on what template the module is placed on. But I can’t seem to find anything in the docs, which is weird because I feel like this is something many devs would utilize. I’m normally a Wordpress dev and doing something like this is super simple.
I was hoping there was some content variable or a way to do something like this. I realize these variables don’t exist, I’m just showing what I hope there was something similar to.
{% if content.page_template_path == '/path/to/draganddroptemplate/template-name' %}
OR
{% if content.template_name == 'template-name' %}
I know there is content.template_path but when I put that in my custom module, it returns the path of the generated html file for the module itself, not the drag and drop template that is being used for the page it’s on.
Any suggestions or help would be greatly appreciated.
