diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cdbfc81..c2718796 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ Instead of storing the elements with the label as key and the uri as value the array now stores an array of array elements with 3 keys: `label`, `uri` and `item`. +## 1.1.1 (2012-05-17) + +* Added the children attributes and the extras in the array export + ## 1.1.0 (2012-05-17) * Marked `Knp\Menu\ItemInterface::getCurrentItem` as deprecated diff --git a/src/Knp/Menu/MenuItem.php b/src/Knp/Menu/MenuItem.php index 85b50ca8..abde8225 100644 --- a/src/Knp/Menu/MenuItem.php +++ b/src/Knp/Menu/MenuItem.php @@ -2,10 +2,6 @@ namespace Knp\Menu; -use Knp\Menu\Iterator\ItemIterator; -use Knp\Menu\Renderer\RendererInterface; -use Knp\Menu\Renderer\ListRenderer; - /** * Default implementation of the ItemInterface */ @@ -1140,6 +1136,8 @@ public function toArray($depth = null) 'attributes' => $this->attributes, 'labelAttributes' => $this->labelAttributes, 'linkAttributes' => $this->linkAttributes, + 'childrenAttributes' => $this->childrenAttributes, + 'extras' => $this->extras, 'display' => $this->display, 'displayChildren' => $this->displayChildren, ); diff --git a/tests/Knp/Menu/Tests/MenuItemGetterSetterTest.php b/tests/Knp/Menu/Tests/MenuItemGetterSetterTest.php index 1c9c8b00..d67e406b 100644 --- a/tests/Knp/Menu/Tests/MenuItemGetterSetterTest.php +++ b/tests/Knp/Menu/Tests/MenuItemGetterSetterTest.php @@ -211,6 +211,8 @@ public function testToArrayWithChildren() 'attributes' => array(), 'labelAttributes' => array(), 'linkAttributes' => array(), + 'childrenAttributes' => array(), + 'extras' => array(), 'display' => true, 'displayChildren' => true, 'children' => array( @@ -221,6 +223,8 @@ public function testToArrayWithChildren() 'attributes' => array(), 'labelAttributes' => array(), 'linkAttributes' => array('title' => 'php'), + 'childrenAttributes' => array(), + 'extras' => array(), 'display' => false, 'displayChildren' => true, 'children' => array( @@ -231,6 +235,8 @@ public function testToArrayWithChildren() 'attributes' => array(), 'labelAttributes' => array(), 'linkAttributes' => array(), + 'childrenAttributes' => array(), + 'extras' => array(), 'display' => true, 'displayChildren' => true, 'children' => array(), @@ -244,6 +250,8 @@ public function testToArrayWithChildren() 'attributes' => array('class' => 'leaf'), 'labelAttributes' => array('class' => 'center'), 'linkAttributes' => array(), + 'childrenAttributes' => array(), + 'extras' => array(), 'display' => true, 'displayChildren' => false, 'children' => array(), @@ -270,6 +278,8 @@ public function testToArrayWithLimitedChildren() 'attributes' => array(), 'labelAttributes' => array(), 'linkAttributes' => array(), + 'childrenAttributes' => array(), + 'extras' => array(), 'display' => true, 'displayChildren' => true, 'children' => array( @@ -280,6 +290,8 @@ public function testToArrayWithLimitedChildren() 'attributes' => array(), 'labelAttributes' => array(), 'linkAttributes' => array('title' => 'php'), + 'childrenAttributes' => array(), + 'extras' => array(), 'display' => false, 'displayChildren' => true, ), @@ -290,6 +302,8 @@ public function testToArrayWithLimitedChildren() 'attributes' => array('class' => 'leaf'), 'labelAttributes' => array('class' => 'center'), 'linkAttributes' => array(), + 'childrenAttributes' => array(), + 'extras' => array(), 'display' => true, 'displayChildren' => false, ), @@ -313,6 +327,8 @@ public function testToArrayWithoutChildren() 'attributes' => array(), 'labelAttributes' => array(), 'linkAttributes' => array(), + 'childrenAttributes' => array(), + 'extras' => array(), 'display' => true, 'displayChildren' => true, ),