Extending component shareable layouts

From CjWiki
Jump to: navigation, search

All corejoomla components uses Joomla shareable layout system so that they can be used anywhere with less configuration.

Please read more about shareable layouts here:
https://docs.joomla.org/J3.x:Sharing_layouts_across_views_or_extensions_with_JLayout

To override any component layout:

  1. Identify the layout file you would like to override
  2. Copy the layout files to your override directory
  3. Make modifications and you are good to go.

Joomla will search the overrides in specific folders in the order below. Whichever finds it first, it will use it.

[0] => /templates/yourtemplatename/html/layouts/com_componentname
[1] => /components/com_componentname/layouts
[2] => /templates/yourtemplatename/html/layouts
[3] => /layouts

So, for example, if you would like to override the layout file components/com_communityanswers/layouts/default/toolbar.php; copy the toolbar.php file to /templates/yourtemplatename/html/layouts/com_communityanswers/default/toolbar.php and do your modifications.