Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 33825d8

Browse files
committed
Merge pull request #149 from benglass/menu_admin_to_string
Add toString method to base menu node admin for displaying labels.
2 parents c007cda + eec4263 commit 33825d8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Admin/AbstractMenuNodeAdmin.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Sonata\AdminBundle\Show\ShowMapper;
1818
use Sonata\DoctrinePHPCRAdminBundle\Admin\Admin;
1919
use Symfony\Cmf\Bundle\MenuBundle\Model\MenuNode;
20+
use Symfony\Cmf\Bundle\MenuBundle\Model\MenuNodeBase;
2021
use Symfony\Cmf\Bundle\MenuBundle\ContentAwareFactory;
2122

2223
/**
@@ -152,4 +153,12 @@ public function setContentTreeBlock($contentTreeBlock)
152153
{
153154
$this->contentTreeBlock = $contentTreeBlock;
154155
}
156+
157+
public function toString($object)
158+
{
159+
return $object instanceof MenuNodeBase && $object->getLabel()
160+
? $object->getLabel()
161+
: parent::toString($object)
162+
;
163+
}
155164
}

0 commit comments

Comments
 (0)