Closed skounis closed 6 years ago
@skounis Hi, Stavros. I'm sure that our module doesn't use common theme templates. It has only own template, the template for the block and separates HTML file which we inject into the main template using the hook.
@a4dyakonov So do we have the option to create our own mt_countdown_inject.html.twig
in the folder of the active theme?
Will this override the the template file of the module?
Could you please confirm?
We can override the template of our module. It is mt_countdown.html.twig. But mt_countdown_inject.html.twig is not a template, it separates HTML file. We have to override it using the hook.
We should implement hook_page_attachments_alter().
Alex,
We should improve that, we should be able to override everything by using template files. Is that possible?
@skounis Then we will have what we had in the previous version. We must replace the main template with our template. But this is not exactly Drupal's way. Because we do not know what will happen if someone else redefines this template. We can not insert a template into another template without using a hook.
@a4dyakonov Could our code, in the module, checks the active theme for a template file with this name?
It is very crucial to allow the users to override our templates (HTML snippets) at the theme's level, by creating HTML/twig
files.
@skounis I've Added ability checks the active theme of a template file with mt_countdown_inject.html.twig name. If it does not exist, we include our module file.
@a4dyakonov It looks fine. It is merged. We will test. Thank you
@a4dyakonov Could you please confirm that the template files, this module has, could be overridden if we use the same file names in the selected/active theme?
People here have reported that they tried that with no success.