Note: these instructions are for dev-master branch, if you are using stable version (1.3) read this "Using the layout" for old 1.3 version.
In order to use the layout, your views should extend from the provided default-layout
{% extends '@AvanzuAdminTheme/layout/default-layout.html.twig' %}
Instead of fully relying on blocks and includes, you are provided with a twig global named avanzu_admin_context
to store and retrieve particular values throughout the page rendering.
This is basically a parameter bag with some pre-defined values based on the bundle configuration.
In order to make overriding some of the template regions easier, there are several partials included within the layout which can be overridden individually as described here.
Listed in the order of appearance, these are:
- @AvanzuAdminTheme/Partials/_head.html.twig
- Defines the `head` tag contents.
- @AvanzuAdminTheme/Sidebar/knp-menu.html.twig
- Renders the knp menu using the builder defined as `main_menu`.
___Notice___ *this partial will only be included when the knp_menu is enabled.* - @AvanzuAdminTheme/Breadcrumb/knp-breadcrumb.html.twig
- Rendes the knp menu using the builder defined as `breadcrumb_menu`
___Notice___ *this partial will only be included when the knp_menu is enabled.* - @AvanzuAdminTheme/Partials/_footer.html.twig
- Renders the main footer
- @AvanzuAdminTheme/Partials/_control-sidebar.html.twig
- Renders the control sidebar (righthand panel) unless it is disabled in the config (default)
- @AvanzuAdminTheme/Partials/_scripts.html.twig
- Renders script tags. Located right before the closing `body`.
The blocks are defined in the layout in order of appearance. Some of them do contain some of the major components like the sidebar or navbar. In order to redefine the block and to keep the default content, don't forget to use {{parent()}}
- avanzu_document_title
- Defines the `title` defaults to the contents of `avanzu_page_title`
- avanzu_head
- comes right after the `_head.html.twig` partial
- avanzu_body_start
- In the `body` tag, useful for Angular attributes like ng-app
- avanzu_after_body_start
- comes right after the opening `body` tag
- avanzu_logo_path
- The href value of `a.logo`
- avanzu_logo_mini
- Contents of `.logo-mini`
- avanzu_logo_lg
- Contents of `.logo-lg`
- avanzu_navbar_toggle
- Renders the `.sidebar-toggle` button
- avanzu_navbar_messages
- Renders the `messages` component
- avanzu_navbar_notifications
- Renders the `notifications` component
- avanzu_navbar_tasks
- Renders the `tasks` component
- avanzu_navbar_user
- Renders the `user` component
- avanzu_navbar_control_sidebar_toggle
- Renders the toggle for the `control_sidebar` (if enabled)
- avanzu_sidebar_user
- Renders the `userPanel` component
- avanzu_sidebar_search
- Renders the `searchPanel` component
- avanzu_sidebar_nav
- Renders the `menu` component _or_ includes `@AvanzuAdminTheme/Sidebar/knp-menu.html.twig` depending on wether the `knp_menu` is enabled or not.
- avanzu_page_title
- Defines the page header inside `.content-header` *(and implicitly the `title` if you haven't changed the content of `avanzu_document_title`)*
- avanzu_page_subtitle
- Defines the `small` portion of `.content-header`
- avanzu_breadcrumb
- Renders either the `breadcrumb` component or includes `@AvanzuAdminTheme/Breadcrumb/knp-breadcrumb.html.twig` based on your configuration.
- avanzu_page_content
- The main content area.
- avanzu_page_content_class
- The CSS class for the content block `avanzu_page_content`.
- avanzu_page_content_before
- A block to add additional content right before the start of `avanzu_page_content`.
- avanzu_page_content_after
- A block to add additional content right after the end of `avanzu_page_content`.
- avanzu_footer
- The main footer. Includes `@AvanzuAdminTheme/Partials/_footer.html.twig` by default.
- avanzu_control_sidebar
- Includes `@AvanzuAdminTheme/Partials/_control-sidebar.html.twig` if it is enabled.
- avanzu_javascripts
- comes right after the `_scripts.html.twig` partial.
- avanzu_javascripts_inline
- Intended for inline scripts in order to keep those in one single document block.