Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Latest commit

 

History

History
198 lines (131 loc) · 5.41 KB

layout.md

File metadata and controls

198 lines (131 loc) · 5.41 KB

Using the layout

In order to use the layout, your views should extend from the provided default-layout

{% extends '@AdminLTE/layout/default-layout.html.twig' %}

Twig Context-Helper

Instead of fully relying on blocks and includes, you are provided with a twig global named admin_lte_context to retrieve several configuration values throughout the page rendering.

This is basically a parameter bag with some pre-defined values based on the bundle configuration. It contains the following configuration keys:

  • everything from admin_lte.options
  • button from admin_lte.theme.button
  • widget from admin_lte.theme.widget
  • control_sidebar from admin_lte.control_sidebar
  • knp_menu from admin_lte.knp_menu

To see all available settings, simply dump it in one of your templates:

{{ dump(admin_lte_context.options) }}

Layout files

This bundle ships with two main template files which you need to extend in your theme:

  • default-layout.html.twig for all default files
{% extends '@AdminLTE/layout/default-layout.html.twig' %}
  • security-layout.html.twig for the security screens (login, register, forgot password)
{% extends '@AdminLTE/layout/security-layout.html.twig' %}

See FOSUserBundle for an easy integration of the security functionality.

Partials

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:

@AdminLTE/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.*
@AdminLTE/Breadcrumb/knp-breadcrumb.html.twig
Renders the knp menu using the builder defined as `breadcrumb_menu`
___Notice___ *this partial will only be included when the knp_menu is enabled.*
@AdminLTE/Partials/_footer.html.twig
Renders the main footer
@AdminLTE/Partials/_control-sidebar.html.twig
Renders the control sidebar (right-hand panel) WHEN there are configured panels in the config `admin_lte.options.control_sidebar`

Layout blocks

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()}}.

security-layout.html.twig

login_box
The main content block, containing the complete body of the
logo_login
The welcome title, should hold your application name or logo icon
login_box_msg
The box (inside) title, e.g. when you have different forms add a short title/explanation here
login_box_error
Security errors will be rendered in this block
login_form
login_form_start
login_form_end
login_social_auth
login_actions

default-layout.html.twig

html_start
Allows to add additional attributes to the `html` tag (like `ng-app` for Angular)
title
Defines the `title` and defaults to the contents of the block `page_title`
stylesheets
Defines all stylesheet tags that will be embedded in the `head` section
head
additional tags that go into the `head` section
body_start
Can be used to add additional attributes in the `body` tag (like `ng-app` for Angular)
after_body_start
comes right after the opening `body` tag
logo_path
The href value of `a.logo`
logo_mini
Contents of `.logo-mini`
logo_large
Contents of `.logo-lg`
navbar_toggle
Renders the `.sidebar-toggle` button
navbar_messages
Renders the `messages` component
navbar_notifications
Renders the `notifications` component
navbar_tasks
Renders the `tasks` component
navbar_user
Renders the `user` component
navbar_control_sidebar_toggle
Renders the toggle for the `control_sidebar` (if enabled)
sidebar_user
Renders the `userPanel` component
sidebar_search
Renders the `searchPanel` component
sidebar_nav
Renders the `menu` component _or_ includes `@AdminLTE/Sidebar/knp-menu.html.twig` depending on wether the `knp_menu` is enabled or not.
page_title
Defines the page header inside `.content-header` and implicitly the `title` if you haven't changed the content of `title`
page_subtitle
Defines the `small` portion of `.content-header`
breadcrumb
Renders either the `breadcrumb` component or includes `@AdminLTE/Breadcrumb/knp-breadcrumb.html.twig` based on your configuration.
page_content
The main content area.
page_content_class
The CSS class for the content block `page_content`.
page_content_before
A block to add additional content right before the start of `page_content`.
page_content_after
A block to add additional content right after the end of `page_content`.
footer
The main footer. Includes `@AdminLTE/Partials/_footer.html.twig` by default.
control_sidebar
Includes `@AdminLTE/Partials/_control-sidebar.html.twig`
javascripts
block to render `script` tags right before the closing `body`

Next steps

Please go back to the AdminLTE bundle documentation to find out more about using the theme.