From 9d2d3cede51f4320f5ae9c5caa1d828a574d1ed4 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Thu, 17 May 2012 17:32:54 +0200 Subject: [PATCH] Added the children attributes and the extras in the array export --- CHANGELOG.md | 4 ++++ src/Knp/Menu/MenuItem.php | 6 ++---- .../Knp/Menu/Tests/MenuItemGetterSetterTest.php | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d9f5b6c..caa8f53a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 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 c08b558e..5c23de32 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 */ @@ -1090,6 +1086,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, ),