I try to use a custom twig template file without success

  • copy modal-page-modal.html.twig from module template directory to your custom theme template directory and modify it.
  • clear all caches
  • clear all caches multiple times
  • the template from my custom theme folder is never used

correct the module to load a custom template. It would be nice to have suggestions based on modal id

Issue fork modal_page-3283208

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

realgiucas created an issue. See original summary.

renatog’s picture

Category: Bug report » Feature request

Hello @realgiucas how are you?

Thank you so much for using the project

The template override functionality isn't implemented yet but I really thought about it. It should be a very cool feature!

So I'm converting to Feature Request ok?

P.s. We don't have so much time actually but if you want to contribute with that, any patches or merge-requests will be welcome

paulocs’s picture

Assigned: Unassigned » paulocs

Working on it.

paulocs’s picture

Version: 4.1.14 » 4.1.x-dev
Assigned: paulocs » Unassigned
Status: Active » Needs review

Just created a MR for it. Please review.

lucassc’s picture

Assigned: Unassigned » lucassc
lucassc’s picture

Assigned: lucassc » Unassigned
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new2.47 KB
new14.28 KB
new14.65 KB
new74.28 KB

Hi!

I applied MR !24 locally for 9.4.x and works fine.

Steps:
- created a custom module named "test_module";
- file "test_module.module" was created with hook_theme implementation (see "test_module_module_content.txt" attached);
- created "templates" folder inside the test_module;
- file "modal-page-modal.html.twig" was copied to new "templates" folder above;
- then I modified line 26 of "modal-page-modal.html.twig" from <h4 id="{{ id_label }}" class="modal-title modal-page-title">{{ title }}</h4> to <h4 id="{{ id_label }}" class="modal-title modal-page-title">modifying something</h4>.

Attaching screenshots of the results (see before.png and after.png).

I also enabled twig debug so I could see from where the output is coming and the given file names suggestions. (see twig _debug.png)

  • paulocs committed 5c415af on 4.1.x
    Issue #3283208 by paulocs, lucassc, realgiucas, RenatoG: twig template...
paulocs’s picture

Status: Reviewed & tested by the community » Fixed

Thank you!

renatog’s picture

Awesome. Thank you so much team

Adding the parent for the new release

renatog’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.