How to use my app layout on existent projects?

  1. Register a new hook in your current theme
    // app/apps/themes/my_theme/config/config.json
    "on_active"
    : ["....."],
    "front_default_layout": ["my_theme_set_custom_layout"] # my_theme_set_custom_layout is the helper name
  2. Create the helper for the hook
    # app/apps/themes/my_theme/main_helper.rb
    def my_theme_set_custom_layout(args)
    args[:layout] = 'application' # set the name of the custom layout to be used
    end
    Note 1: Don't use 'index' as layout because it exists in your theme and default_theme (new versions will be removed from default_theme)
    Note 2: The template render priority is the following:
    Template:
      themes/default/views/layouts/<my_layout>
      camaleon_cms/default_theme/layouts/<my_layout>
      /layouts/<my_layout>

    Directory:
      my_project/app/apps
      camamleon_cms_gempath/app/apps
      my_project/app/views


  3. Restart server

Note: There more hooks that permit to customize templates and layouts for each section of frontend, like: on_render_index, on_render_category, ...

Created at: 09 Oct 07:17 | Updated at: 09 Oct 07:17