kunicmarko / simple-menu-bundle
This is a Symfony Bundle that adds menu functionality to Sonata Admin.
Installs: 26
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.0
- gedmo/doctrine-extensions: ^2.4
- symfony/framework-bundle: ~2.8|~3.0
This package is auto-updated.
Last update: 2022-02-01 13:09:27 UTC
README
Simple Menu Bundle adds Menu to your Symfony application and is integrated with Sonata Admin.
This bundle depends on SonataAdminBundle and DoctrineExtensions
Documentation
Installation
1. Add to composer.json to the require
key
composer require kunicmarko/simple-menu-bundle "v1.0.0-beta"
2. Register the bundle in app/AppKernel.php
$bundles = array(
// ...
new KunicMarko\SimpleMenuBundle\SimpleMenuBundle(),
);
Add Gedmo Tree extensions mappings and if you are not using auto_mapping add bundle mappings
# app/config/config.yml
orm:
entity_managers:
default:
mappings:
#...
SimpleMenuBundle: ~
gedmo_tree:
type: annotation
prefix: Gedmo\Tree\Entity
dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity"
alias: Gedmo
is_bundle: false
3. Update database
app/console doctrine:schema:update --force
4. Clear cache
app/console cache:clear
5. Install assets
app/console assets:install
How to use
In your twig template you can render it with:
{{ simple_menu_render('machine_name', level) }}
or if you want to render it on your own you can:
{% set menu = simple_menu_fetch('machine_name', level) %}
Override template
You can override default template from config:
# app/config/config.yml
simple_menu
template:
render: SimpleMenuBundle:Menu:render.html.twig