Download the PHP package webfactory/navigation-bundle without Composer
On this page you can find all versions of the php package webfactory/navigation-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package navigation-bundle
WebfactoryNavigationBundle
Symfony Bundle featuring:
- A factory for creating the navigation tree, using BuildDirectors which you can add to, if needed
- Twig functions for rendering navigation elements (tree, ancestry, breadcrumbs) and inspecting the navigation tree
Installation
composer require webfactory/navigation-bundle
... and activate the bundle in your kernel, depending on your Symfony version.
Rendering navigation elements in Twig
Simple Navigation List
Syntax
{{ navigation_tree(root, maxLevels = 1, expandedLevel = 1, template = '@WebfactoryNavigation/Navigation/navigation.html.twig') }}
Examples
{{ navigation_tree(root = {"webfactory_pages.page_id": root_page_id}) }}
{{ navigation_tree(
root = {"webfactory_pages.page_id": root_page_id, "_locale": app.request.locale},
template = 'AppBundle:Navigation:navigation.html.twig'
) }}
Ancestry List
An ancestry list is the active path from the given start level to the currently active node. Useful if you want to render e.g. the third level navigation outside of the regular navigation.
Syntax
{{ navigation_ancestry(startLevel, maxLevels = 1, expandedLevels = 1, template = '@WebfactoryNavigation/Navigation/navigation.html.twig') }}
Examples
{{ navigation_ancestry(startLevel = 1) }}
{{ navigation_ancestry(startLevel = 1, template = '@App/Navigation/secondaryNav.html.twig') }}
Breadcrumbs
Syntax
{{ navigation_breadcrumbs(template = '@WebfactoryNavigation/Navigation/breadcrumbs.html.twig') }}
Examples
{{ navigation_breadcrumbs() }}
{{ navigation_breadcrumbs(template = '@App/Navigation/breadcrumbs.html.twig') }}
Customisation
For each function mentioned above you can provide a Twig template in which you can extend the base template and
overwrite each block. Please find the default blocks in src/Resources/views/Navigation/navigationBlocks.html.twig
.
Example:
Modifying the NavigationTree
Implement a Webfactory\Bundle\NavigationBundle\Build\BuildDirector
. Example:
Define your implementation as a service and tag it webfactory_navigation.build_director
. Example:
See src/Resources/doc/How-To-Use-Klassendiagramm.puml
for more.
Credits, Copyright and License
This project was started at webfactory GmbH, Bonn.
Copyright 2015 - 2021 webfactory GmbH, Bonn. Code released under the MIT license.
All versions of navigation-bundle with dependencies
ext-json Version *
psr/container Version ^1.0
psr/log Version ^1.1|^2.0|^3.0
symfony/config Version ^4.0|^5.0|^6.0|^7.0
symfony/console Version ^4.0|^5.0|^6.0|^7.0
symfony/dependency-injection Version ^4.2|^5.0|^6.0|^7.0
symfony/event-dispatcher Version ^4.3|^5.0|^6.0|^7.0
symfony/event-dispatcher-contracts Version ^1.0|^2.0|^3.0
symfony/http-foundation Version ^5.3|^6.0|^7.0
symfony/http-kernel Version ^4.0|^5.0|^6.0|^7.0
symfony/proxy-manager-bridge Version ^4.0|^5.0|^6.0|^7.0
symfony/service-contracts Version ^1.0|^2.0|^3.0
twig/twig Version ^1.36|^2.6|^3.0