Developers

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

The configuration tree follows the module/action logic. In this example I have two modules, main and blog,
but you can add all the modules you need the breadcrumbs for:

sf_orm_breadcrumbs:
main:
...
blog:
...

Let's take a look at blog module. I provided breadcrumbs for three actions, index, showPost and permalink.

index has the simplest configuration. It tells the plugin to show just one breadcrumb with name "Blog" and
linked to the route "blog", which is a sfRoute object.

blog:
index:
- { name: 'Blog', route: blog }

showPost is a little more complex. It consists of two breadcrumbs; the first is identical to the index one,
but the second tells the plugin to show a breadcrumb for a sfDoctrineRoute object. You can set this by
adding the model parameter to the breadcrumb element. More, you can set the name of the breadcrumb by
taking a property from the model object the route is bound to.

...then I can tell the plugin to create a breadcrumb that takes a subobject (a Post) via class method
from my rule object (the Permalink) and link it to a sfDoctrineRoute suitable for the subobject.

NOTE: considerations and examples so far are equivalent and valid also with sfPropelRoute objects. It does not change anything.

Optional configuration

The following parameters are not mandatory, they just tweak some stuff for a better customization of your breadcrumbs.

Root breadcrumb. You can specify a breadcrumb to always show before the context ones.
This breadcrumb work in the exact same way as the others, but it can't be used for model bound routing rules.
You can make a simple text appear before the other breadcrumbs this way:

sf_orm_breadcrumbs:
_root: { name: My site }

or you can even decide to point your root breadcrumb to your homepage, like this:

sf_orm_breadcrumbs:
_root: { name: Homepage, route: homepage }

Custom separator. The default separator character for the breadcrumb is '>'.
To set a custom character:

sf_orm_breadcrumbs:
_separator: '&raquo;'

Lost text. If your configuration do not provide breadcrumbs for an action you are in, this text
is displayed instead. Default text is 'somewhere'. To set a custom text:

sf_orm_breadcrumbs:
_lost: 'somewhere...'

Default case manipulation for breadcrumb name. You can set a php function name to manipulate the breadcrumbs name with.
You can choose among ucfirst, lcfirst, strotolower, strtoupper, ucwords.
You can even override this default setting by providing case option for a breadcrumb item, in the configuration file.