This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Vojta Svoboda
Vojta Svoboda

What is the best practise to override plugin's templates? When I want to override /plugins/rainlab/user/components/account/signin.htm? Or registration form? Im trying to create folder /resources/rainlab/user/components/account/signin.htm, but it doesn't work.

Thanks for reply!

Last updated

keystroke
keystroke

Add a component to a page. When added, give it a unique alias. Let's say we call it "myAwesomeComponent". Look in the plugin's component folder and find the correct .htm partial file to override. Let's say this is "default.htm". From the CMS, create a partial with the filename myAwesomeComponent/default.htm. Paste the contents of the original default.htm in that and change how you like. So it's never really based on the plugin or component name just the alias. This way, you can create several different sign-in forms that are all based on the same component.

Last updated

vince_o
vince_o

@keystroke Is it possible to organize the theme's partials folder into subdirectories? For example, if you wanted to override all of the blog plugin's components, you could create a blog directory within the partials folder, and place all of the component override files inside?

Vojta Svoboda
Vojta Svoboda

@vince_o I don't think so

info14532
info14532

Full instructions on the method Keystroke explained with screenshots on how to override plugin templates here

justas.raudonius23340
justas.raudonius23340

info14532 said:

Full instructions on the method Keystroke explained with screenshots on how to override plugin templates here

It is not even required to rename the component to be able to override. Works perfectly.

info14532
info14532

That's correct but it makes the codebase cleaner as having two files with the same name can get confusing and at some point, you will edit the wrong file.

info14532
info14532

That's correct but it makes the codebase cleaner as having two files with the same name can get confusing and at some point, you will edit the wrong file.

WaskiWabit
WaskiWabit

@justas.raudonius23340 That is because it resides in a different namespace.

@info14532 if you pay attention to the namespaces. It's actually beneficial to have things more standardized.You should be able to have many files with the same name. If you are getting confused, you should read up more on OOP. Note: Each time you create a controller/model/etc via artisan, it generate files with the exact same names (fields.yaml, columns.yaml, config_list.yaml, etc). Yet you are saying that makes things confusing? It really doesn't. It makes things simpler.

Last updated

1-9 of 9

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.