44 lines
1.3 KiB
PHP
44 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Trinity\Bundle\AdminMenuBundle\Menu;
|
|
|
|
use Trinity\Bundle\AdminMenuBundle\Menu\MenuItem;
|
|
use Knp\Menu\MenuFactory as BaseMenuFactory;
|
|
|
|
class MenuFactory extends BaseMenuFactory
|
|
{
|
|
public function createItem($name, array $options = array())
|
|
{
|
|
$item = new MenuItem($name, $this);
|
|
|
|
$options = array_merge(
|
|
array(
|
|
'uri' => '#',
|
|
'label' => null,
|
|
'attributes' => array(),
|
|
'linkAttributes' => array(),
|
|
'childrenAttributes' => array(),
|
|
'labelAttributes' => array(),
|
|
'extras' => array(),
|
|
'display' => true,
|
|
'displayChildren' => true,
|
|
),
|
|
$options
|
|
);
|
|
|
|
$item
|
|
->setUri($options['uri'])
|
|
->setLabel($options['label'])
|
|
->setAttributes($options['attributes'])
|
|
->setLinkAttributes($options['linkAttributes'])
|
|
->setChildrenAttributes($options['childrenAttributes'])
|
|
->setLabelAttributes($options['labelAttributes'])
|
|
->setExtras($options['extras'])
|
|
->setDisplay($options['display'])
|
|
->setDisplayChildren($options['displayChildren'])
|
|
;
|
|
|
|
return $item;
|
|
}
|
|
}
|