Skip to content

Commit

Permalink
Pass menu item to extras.
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Nikolaev committed Jan 29, 2019
1 parent 69aef5a commit 06449f9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ darvin_menu:
6.8.8: Keep menu order in admin sidebar.
6.8.9: Breadcrumbs menu builder: do not reset menu item URL if associated object is hidden.
6.8.11: Pass menu item to extras.
6 changes: 6 additions & 0 deletions Item/AbstractItemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Darvin\MenuBundle\Item;

use Darvin\ImageBundle\Entity\Image\AbstractImage;
use Darvin\MenuBundle\Entity\Menu\Item;
use Knp\Menu\FactoryInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

Expand Down Expand Up @@ -109,10 +110,15 @@ protected function configureExtras(OptionsResolver $resolver)
{
$resolver
->setDefaults([
'menuItem' => null,
'objectName' => null,
'objectId' => null,
'object' => null,
])
->setAllowedTypes('menuItem', [
Item::class,
'null',
])
->setAllowedTypes('objectName', [
'string',
'null',
Expand Down
1 change: 1 addition & 0 deletions Item/MenuItemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ protected function getExtras($menuItem)
}

return array_merge(parent::getExtras($menuItem), [
'menuItem' => $menuItem,
'objectName' => $objectName,
'objectId' => $objectId,
'object' => $object,
Expand Down

0 comments on commit 06449f9

Please sign in to comment.