backdrop-ops / docs.backdropcms.org

Website for displaying Backdrop CMS documentation and API source code.
https://docs.backdropcms.org/
6 stars 6 forks source link

Overriding layout templates #36

Open ghost opened 7 years ago

ghost commented 7 years ago

I had a need to override my layout template (to move the page title to another region) and wondered how to do it. I found a comment on Reddit suggesting that you may be able to copy the template file to your theme and customise it there. Sure enough, that worked. But it didn't seem obvious to me at first.

I therefore suggest adding a page to https://api.backdropcms.org/developing-layouts explaining how to override layout templates by adding them to your theme. I can do it, just wanted to make sure it was allowed/approved and also ask what other info should go there...?

klonos commented 5 years ago

@BWPanda I think that you should go ahead and create something as draft, then link to it from here for others to review. We can edit it and/or move it around later.

ghost commented 5 years ago

Here you go! https://api.backdropcms.org/documentation/overriding-layout-templates It's a draft, so feel free to either make changes yourself, or post them here and I'll make them. Then we can publish!

jenlampton commented 4 years ago

I love this documentation!!! I made some small edits, and changed the names of things, as follows:

Sure enough, that worked. But it didn't seem obvious to me at first.

This is how every single piece of markup in Drupal / Backdrop is overridden in a theme. It works with theme functions and template files that come from anywhere: system, modules, layouts (which are also just overriding the layout module) and base-themes.

A thought: Should we make a more general "how to override markup" docs page too, and then make this a child page of that page?

There's nothing special about layouts other than the fact that they are new and people coming from Drupal will have a hard time with the conceptual shift. But technically, they work the same way as everything else.