prime/navigation-bundle

Navigation bundle for Symfony2, 3, 4

v1.0 2015-02-23 08:07 UTC

This package is not auto-updated.

Last update: 2024-11-08 12:19:55 UTC


README

Install

Add PrimeNavigationBundle to your composer.json

"require": {
    "prime/navigation-bundle": "dev-v2.0-beta"
}

Enable bundle

Add bundle to AppKernel

<?php
// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Prime\NavigationBundle\PrimeNavigationBundle(),
    );
}

Create your first navigation

<?php
// src/AppBundle/Navigation/MainNavigation.php

namespace AppBundleBundle\Navigation;


class MainNavigation
{

    public function build()
    {
        return array(
            array(
                'label' => 'Page #1',
                'route' => 'route_homepage'
            ),
            array(
                'label' => 'Page #2',
                'route' => 'route_page',
                'routeParameters => array('slug' => 'page_2')
            ),
        );
    }
}

Render navigation

{{ navigation('AppBundle:Navigation:Main') }}

Configuration

// app/config.yml

prime_navigation:
    template: 'PrimeNavigationBundle:Navigation:simple.html.twig'
    breadcrumbs_template: 'PrimeNavigationBundle:Navigation:breadcrumbs.html.twig'