Download the PHP package yceruto/breadcrumbs-bundle without Composer
On this page you can find all versions of the php package yceruto/breadcrumbs-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yceruto/breadcrumbs-bundle
More information about yceruto/breadcrumbs-bundle
Files in yceruto/breadcrumbs-bundle
Package breadcrumbs-bundle
Short Description Magic breadcrumbs bundle for Symfony application
License MIT
Homepage https://github.com/yceruto/breadscrumbs-bundle
Informations about the package breadcrumbs-bundle
Symfony > Bundle > Breadcrumbs
A friendly way to create breadcrumbs for symfony applications.
Features
- Build breadcrumbs through current request uri (default).
- Customize breadcrumbs nodes.
- Customize breadcrumbs template.
Installation
Step 1: Download the Bundle
This command requires you to have Composer installed globally, as explained in the Composer documentation.
Step 2: Enable the Bundle
Basic Usage
Render the breadcrumbs in your template
Render the breadcrumb through current request path info.
That's it!
How it work
Suppose you the follows routes and translation:
For this request path /store/foo/bar
the render_breadcrumbs()
function returns:
If your application does not use translation feature, you can set the label text in route definition:
Translate the Breadcrumbs Interface
The breadcrumbs uses the same language as the underlying Symfony application, which
is usually configured in the locale
option of the app/config/parameters.yml
file.
The strings that belong to the breadcrumbs interface are translated using the
default messages
domain.
In addition, make sure that the translator
service is enabled in the
application (projects based on the Symfony Standard Edition have it disabled
by default):
Advanced Usage
Customize the breadcrumb nodes
Render customized breadcrumbs:
Overriding Default BreadcrumbsBundle Template
As you start to incorporate BreadcrumbsBundle into your application, you will probably find that you need to override the default template that is provided by the bundle. Although the template name is not configurable, the Symfony framework provides two ways to override the templates of a bundle.
- Define a new template of the same name in the
app/Resources
directory - Create a new bundle that is defined as a child of
BreadcrumbsBundle
Example: Overriding The Default breadcrumbs.html.twig
An example of overriding this breadcrumbs template is demonstrated below using first of the overriding options listed above.
Here is the default breadcrumbs.html.twig
provided by the BreadcrumbsBundle
:
The following Twig template file is an example of a breadcrumbs file that might be used to override the provided by the bundle.
1) Define New Template In app/Resources
The easiest way to override a bundle's template is to simply place a new one in
your app/Resources
folder. To override the breadcrumbs template located at
Resources/views/breadcrumbs.html.twig
in the BreadcrumbsBundle
directory, you would place
your new breadcrumbs template at app/Resources/BreadcrumbsBundle/views/breadcrumbs.html.twig
.
As you can see the pattern for overriding templates in this way is to
create a folder with the name of the bundle class in the app/Resources
directory.
Then add your new template to this folder, preserving the directory structure from the
original bundle.
Resources
You can run the unit tests with the following command:
$ cd path/to/breadcrumbs-bundle/
$ composer install
$ phpunit
License
This software is published under the MIT License
All versions of breadcrumbs-bundle with dependencies
symfony/framework-bundle Version ~2.3|~3.0
symfony/expression-language Version ~2.6|~3.0
twig/twig Version ~1.14,>=1.14.2|~2.0