1
0
mirror of https://github.com/ToxicCrack/PrintABrick.git synced 2025-05-17 21:00:09 -07:00

Add knpmenubundle

This commit is contained in:
David Hübner 2016-11-21 16:52:36 +01:00
parent 4df522a259
commit f7fc175b11
6 changed files with 152 additions and 9 deletions

View File

@ -16,6 +16,7 @@ class AppKernel extends Kernel
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(), new AppBundle\AppBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
]; ];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {

View File

@ -7,6 +7,7 @@
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" /> <link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
</head> </head>
<body> <body>
{{ knp_menu_render('AppBundle:Builder:mainMenu') }}
{% block body %}{% endblock %} {% block body %}{% endblock %}
{% block javascripts %}{% endblock %} {% block javascripts %}{% endblock %}
</body> </body>

View File

@ -66,3 +66,12 @@ swiftmailer:
username: "%mailer_user%" username: "%mailer_user%"
password: "%mailer_password%" password: "%mailer_password%"
spool: { type: memory } spool: { type: memory }
knp_menu:
# use "twig: false" to disable the Twig extension and the TwigRenderer
twig:
template: KnpMenuBundle::menu.html.twig
# if true, enables the helper for PHP templates
templating: false
# the renderer to use, list is also available by default
default_renderer: twig

View File

@ -22,7 +22,8 @@
"sensio/distribution-bundle": "^5.0", "sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2", "sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0", "incenteev/composer-parameter-handler": "^2.0",
"guzzlehttp/guzzle": "^6.2" "guzzlehttp/guzzle": "^6.2",
"knplabs/knp-menu-bundle": "^2.0"
}, },
"require-dev": { "require-dev": {
"sensio/generator-bundle": "^3.0", "sensio/generator-bundle": "^3.0",

127
composer.lock generated
View File

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "6a0a087c1e2fc52f43e0cdb32405a4f1", "hash": "949a476ee2ada40b63125ce056e2b419",
"content-hash": "6931eab7f98ea98f61f97e66ceeed392", "content-hash": "70644053aa514d2ea5dd949b6ca6e7dd",
"packages": [ "packages": [
{ {
"name": "doctrine/annotations", "name": "doctrine/annotations",
@ -1047,6 +1047,129 @@
], ],
"time": "2014-01-12 16:20:24" "time": "2014-01-12 16:20:24"
}, },
{
"name": "knplabs/knp-menu",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/KnpLabs/KnpMenu.git",
"reference": "964b5b3ca7fd23019147991f4f75f361d061eb20"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/KnpLabs/KnpMenu/zipball/964b5b3ca7fd23019147991f4f75f361d061eb20",
"reference": "964b5b3ca7fd23019147991f4f75f361d061eb20",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"pimple/pimple": "~1.0",
"silex/silex": "~1.0",
"symfony/phpunit-bridge": "~2.7|~3.0",
"symfony/routing": "~2.3|~3.0",
"twig/twig": "~1.16|~2.0"
},
"suggest": {
"pimple/pimple": "for the built-in implementations of the menu provider and renderer provider",
"silex/silex": "for the integration with your silex application",
"twig/twig": "for the TwigRenderer and the integration with your templates"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
}
},
"autoload": {
"psr-4": {
"Knp\\Menu\\": "src/Knp/Menu"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christophe Coevoet",
"email": "stof@notk.org"
},
{
"name": "Knplabs",
"homepage": "http://knplabs.com"
},
{
"name": "Symfony Community",
"homepage": "https://github.com/KnpLabs/KnpMenu/contributors"
}
],
"description": "An object oriented menu library",
"homepage": "http://knplabs.com",
"keywords": [
"menu",
"tree"
],
"time": "2016-09-22 07:36:19"
},
{
"name": "knplabs/knp-menu-bundle",
"version": "2.1.3",
"source": {
"type": "git",
"url": "https://github.com/KnpLabs/KnpMenuBundle.git",
"reference": "0e4af7209dc03e39c51ec70b68ab2ba3177c25de"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/KnpLabs/KnpMenuBundle/zipball/0e4af7209dc03e39c51ec70b68ab2ba3177c25de",
"reference": "0e4af7209dc03e39c51ec70b68ab2ba3177c25de",
"shasum": ""
},
"require": {
"knplabs/knp-menu": "~2.2",
"symfony/framework-bundle": "~2.3|~3.0"
},
"require-dev": {
"symfony/expression-language": "~2.4|~3.0",
"symfony/phpunit-bridge": "~2.7|~3.0"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "2.2.x-dev"
}
},
"autoload": {
"psr-4": {
"Knp\\Bundle\\MenuBundle\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christophe Coevoet",
"email": "stof@notk.org"
},
{
"name": "KnpLabs",
"homepage": "http://knplabs.com"
},
{
"name": "Symfony Community",
"homepage": "https://github.com/KnpLabs/KnpMenuBundle/contributors"
}
],
"description": "This bundle provides an integration of the KnpMenu library",
"keywords": [
"menu"
],
"time": "2016-09-22 12:24:40"
},
{ {
"name": "monolog/monolog", "name": "monolog/monolog",
"version": "1.21.0", "version": "1.21.0",

View File

@ -1,12 +1,20 @@
<?php <?php
/** namespace AppBundle\Menu;
* Created by PhpStorm.
* User: hubnedav use Knp\Menu\FactoryInterface;
* Date: 11/21/16
* Time: 4:20 PM
*/
class Builder class Builder
{ {
public function mainMenu(FactoryInterface $factory, array $options)
{
$menu = $factory->createItem('root');
$menu->addChild('Home', [
'route' => 'homepage'
]);
return $menu;
}
} }