Kazetenn Admin is a symfony bundle that allow you to handle basic pages programatically.
You can use
composer require elvandar/kazetenn_core_admin
to install the bundle.
This bundle provides an administration panel and menu to create a back office.
Here is the configuration reference for the bundle, you can configure it
in config/packages/kazetenn_admin.yaml:
kazetenn_admin:
authorized_roles: []
admin_url: admin
translation_domain: kazetenn_admin
pages:
name:
function: ~
menu_entries:
name:
target: ''
display_name: ''
translation_domain: ''
order: 0
type: route
authorized_roles: []
orientation: vertical
children:
name:
target: ''
order: 0
display_name: ''
translation_domain: ''
authorized_roles: []
type: route
Let's go over all of those in detail:
kazetenn_admin:
admin_url: admin
translation_domain: kazetenn_admin
authorized_roles: []
pages:
name:
function: ~
menu_entries: []
This is the admin menu url prefix. This will produce urls under this format:
http://your_domain/admin_url/
By default, it is set to 'admin'.
This will define the translation domain of the overall menu. This will also be the translation domain fallback if you do not define it for other menus.
This is a collection roles authorized to access the menus. The roles are classics symfony roles.
If you want to allow non-authenticated users to access the admin menu, you must use the 'ANONYMOUS' role.
Except if the 'ANONYMOUS' role is set, a user must have all the defined roles to access the menu.
If you did not define roles for each individual menu, this array will be used as a fallback.
This is where you will be able to define the admin pages.
This is where you will be able to define the different menus.
name:
target: ''
display_name: ''
translation_domain: ''
order: 0
type: route
authorized_roles: []
orientation: vertical
children: []
This will allow you to configure every menu entry in your admin page.
The name of your entry
The type of entry, it can be one of:
This tells the bundle how to interpret the 'target' entry.
The header type is a special type only available for the upper menus. This will render a menu with no link tha is used to create main menus and header menus.
The string that the code will use to render based on the type you provided
https://google.com)The name that will be displayed (and translated)
The translation domain used to translate the name. If left empty, the bundle will fallback to the default defined domain.
The order in which the menu will be rendered. The bundle will throw a warning if 2 menus have the same order.
This is a collection roles authorized to access the menus. The roles are classics symfony roles.
If you want to allow non-authenticated users to access the admin menu, you must use the 'ANONYMOUS' role.
Except if the 'ANONYMOUS' role is set, a user must have all the defined roles to access the menu.
If you did not define roles for each individual menu, this array will be used as a fallback.
This will define if your menu will be displayed in the horizontal head menu or in the vertical side menu. The values are
Here you can define the sub menus
name:
target: ''
order: 0
display_name: ''
translation_domain: ''
authorized_roles: []
type: route
The name of your entry
The type of entry, it can be one of:
This tells the bundle how to interpret the 'target' entry.
The header type is a special type only available for the upper menus. This will render a menu with no link tha is used to create main menus and header menus.
The string that the code will use to render based on the type you provided
https://google.com)The name that will be displayed (and translated)
The translation domain used to translate the name. If left empty, the bundle will fallback to the default defined domain.
The order in which the menu will be rendered. The bundle will throw a warning if 2 menus have the same order.
This is a collection roles authorized to access the menus. The roles are classics symfony roles.
If you want to allow non-authenticated users to access the admin menu, you must use the 'ANONYMOUS' role.
Except if the 'ANONYMOUS' role is set, a user must have all the defined roles to access the menu.
If you did not define roles for each individual menu, this array will be used as a fallback.
There are multiple ways to create a vue within the menu:
The bundle comes with an abstract controller (Kazetenn\Admin\Controller\BaseAdminController). When you extends
it, the render method will automatically provides you with arguments containing the menus you registered.
You can use it in combination with the already existing twig templates (Admin/Resources/views/admin_base.html.twig)
or create your owns.
The admin pages are a way to ensure that the code you created will be displayed in the admin template. You can configure thems using this part of the YAML:
pages:
name:
function: 'FQCN\Of\Your\file::yourFunction'
The name will be used to generate the page url.
The function must be within a specific set of criterias:
If you did so correctly, you can use the http://your_domain/admin_url/display_page/page_name to access your page.
The default admin interface has been created using Bulma (https://bulma.io/)
The pages bundle is under MIT liscence
How can I help you explore Laravel packages today?