Download the PHP package braunstetter/control-panel-bundle without Composer
On this page you can find all versions of the php package braunstetter/control-panel-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download braunstetter/control-panel-bundle
More information about braunstetter/control-panel-bundle
Files in braunstetter/control-panel-bundle
Package control-panel-bundle
Short Description A collection of extensible templates for building great control panels in order to build your software systems.
License MIT
Informations about the package control-panel-bundle
ControlPanelBundle
Sometimes you don't want to commit to a complete admin system. But you would like to have a nice admin panel structure ready to be extended.
Installation
What's inside
Templates
- layouts/base.html.twig (Mobile structure - but empty)
- base.html.twig (contains structure with template hooks)
You can extend these templates, but you can also use
the braunstetter/template-hooks-bundle whose hooks are used
inside of the base.html.twig
file.
FormTypes
This bundle comes with several custom form types. To show you how you can use it, I want to show you an example.
To make this work you need an OrangePuppy
Entity with a title and a description property on it.
Example - Up and running a fully working controlpanel
Create a new symfony project.
Setup the database
For this simple test just use a sqlite database by changing the .env
file to:
`
Create a Controller with a route
Edit the twig template
Change templates/site/index.html.twig
:
Note: don't forget to change the block name from
body
tocontent
Start the webserver and visit your control panel
Now you can see the result by visiting the /site
url.
PageType Example
And here comes the explanation.
- Extend
Braunstetter\ControlPanel\Form\PageType;
(for additional build-methods) - Set the title as an option (Either by submitting the option when creating the form, or by setting it inside
the
configureOptions
method) - Overwrite
public function getParent()
to get view variables and the theme block_prefix inheritance (basically make the styling working ;) - Use the public
buildBodyForm
,buildSidebarForm
,buildToplineRightForm
,buildToplineLeftForm
methods to fill the form.
The result:
The
cp-button-default
is a custom button class this bundle provides.The nice menu on the left side is provided by the braunstetter/menu-bundle.
BoxType
Maybe you ask yourself where the nice sidebar box is coming from. And probably you recognized the TestBoxType
inside the buildSidebarForm
method.
This is the second custom FormType this bundle provides. Here is an example:
This time you just have to overwrite the getParent()
and return the Braunstetter\ControlPanel\Form\BoxType
. (Because this FormType has no special methods.)
The BoxType has the symfony inherit_data option active by default. This way you can just use it just like you put the forms inside the parent class themselves.
All versions of control-panel-bundle with dependencies
braunstetter/template-hooks-bundle Version ^0.2
braunstetter/assets-push-bundle Version ^0.2
symfony/twig-bundle Version ^5.3|^6.0
symfony/asset Version ^5.3|^6.0
symfony/form Version ^5.3|^6.0