kunicmarko/simple-menu-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

This is a Symfony Bundle that adds menu functionality to Sonata Admin.

v1.0.0-beta 2017-08-29 17:52 UTC

This package is auto-updated.

Last update: 2022-02-01 13:09:27 UTC


README

Build Status SensioLabsInsight Latest Stable Version Total Downloads Latest Unstable Version License

Simple Menu Bundle adds Menu to your Symfony application and is integrated with Sonata Admin.

This bundle depends on SonataAdminBundle and DoctrineExtensions

Menu List Menu Children List 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