Skip to content

Commit

Permalink
Added some doc about the children attributes and the 1.1 BC break
Browse files Browse the repository at this point in the history
This replaces #44 with a better explanation.
  • Loading branch information
stof committed Apr 17, 2012
1 parent 599a1ab commit ad10e1e
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions doc/01-Basic-Menus.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,15 @@ $menu->addChild('Home', array('attributes' => array('id' => 'back_to_homepage'))
$menu['Home']->setAttribute('id', 'back_to_homepage');
```

>**NOTE**
>For the root element, the attributes are displayed on the `<ul>` element.
>**NOTE**
>`setAttributes()` will overwrite all existing attributes.
>**NOTE**
>To remove an existing attribute, set it to `null`. It will not be rendered.
You can also add link attributes (displayed on the `<a>` element) or label
attributes (displayed on the `<span>` element when it is not a link):
You can also add link attributes (displayed on the `<a>` element), label
attributes (displayed on the `<span>` element when it is not a link) or
children attributes (rendered on the `<ul>` containing the list of children):

```php
<?php
Expand All @@ -191,8 +189,19 @@ $menu['KnpLabs.com']->setLinkAttribute('class', 'external-link');

$menu->addChild('Not a link');
$menu['Not a link']->setLabelAttribute('class', 'no-link-span');

$menu->setChildrenAttribute('class', 'pull-left');
```

>**NOTE**
>For the root element, only the children attributes are used as only the
>`<ul>` element is displayed.
>**NOTE**
>In the 1.0 version of the library, the attributes were rendered on the root
>element instead of rendering the children attributes, which was inconsistent
>and has been changed for 1.1.
### Rendering only part of a menu

If you need to render only part of your menu, the menu framework gives
Expand Down

0 comments on commit ad10e1e

Please sign in to comment.