Menu/MenuFactory.php
public function createItem($name, array $options = array())
    {
        if (!empty($options['admin'])) {
            $admin = $options['admin'];
            if ( !$options['admin'] instanceof AdminInterface ) {
                $admin = $this->container->get('sonata.admin.pool')->getAdminByAdminCode($admin);
            }
            $action = isset($options['admin_action']) ? $options['admin_action'] : 'list';
            $options['uri'] = $admin->generateUrl($action);
            $options['translationDomain'] = $admin->getTranslationDomain();
        }
        /**
         * Knp\Menu\Silex\RouterAwareFactory
         */
        if (!empty($options['route'])) {
            $params = isset($options['routeParameters']) ? $options['routeParameters'] : array();
            $absolute = isset($options['routeAbsolute']) ? $options['routeAbsolute'] : false;
            $options['uri'] = $this->generator->generate($options['route'], $params, $absolute);
        }
        
        // use VinceT\AdminBundle\Menu\MenuItem
        $item = new MenuItem($name, $this);

        $options = array_merge(
            array(
                'uri' => null,
                'label' => null,
                'attributes' => array(),
                'linkAttributes' => array(),
                'childrenAttributes' => array(),
                'labelAttributes' => array(),
                'extras' => array(),
                'display' => true,
                'displayChildren' => true,
                'translationDomain' => 'messages',
                'displayLink' => true,
                'displayLabel' => 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'])
            ->setTranslationDomain($options['translationDomain'])
            ->setDisplayLink($options['displayLink'])
            ->setDisplayLabel($options['displayLabel']);

        return $item;

        return parent::createItem($name, $options);
    }
public function createItem($name, array $options = array())
    {
        if (!empty($options['admin'])) {
            $admin = $options['admin'];
            if ( !$options['admin'] instanceof AdminInterface ) {
                $admin = $this->container->get('sonata.admin.pool')->getAdminByAdminCode($admin);
            }
            $action = isset($options['admin_action']) ? $options['admin_action'] : 'list';
            $options['uri'] = $admin->generateUrl($action);
            $options['translationDomain'] = $admin->getTranslationDomain();
        }
        /**
         * Knp\Menu\Silex\RouterAwareFactory
         */
        if (!empty($options['route'])) {
            $params = isset($options['routeParameters']) ? $options['routeParameters'] : array();
            $absolute = isset($options['routeAbsolute']) ? $options['routeAbsolute'] : false;
            $options['uri'] = $this->generator->generate($options['route'], $params, $absolute);
        }
        
        // use VinceT\AdminBundle\Menu\MenuItem
        $item = new MenuItem($name, $this);

        $options = array_merge(
            array(
                'uri' => null,
                'label' => null,
                'attributes' => array(),
                'linkAttributes' => array(),
                'childrenAttributes' => array(),
                'labelAttributes' => array(),
                'extras' => array(),
                'display' => true,
                'displayChildren' => true,
                'translationDomain' => 'messages',
                'displayLink' => true,
                'displayLabel' => 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'])
            ->setTranslationDomain($options['translationDomain'])
            ->setDisplayLink($options['displayLink'])
            ->setDisplayLabel($options['displayLabel']);

        return $item;

        return parent::createItem($name, $options);
    }
Create an item

@param string $name    Name of the item
@param array  $options Options

@return VinceT\AdminBundle\Menu\MenuItem