buildItem method

@param MenuItemInterface $item menu item entity
@param string $extLabel additional label elements
@return string generated HTML element
13355
protected function buildItem(MenuItemInterface $item, string $extLabel = ''): string
    {
        try {
            $shortClass = (new ReflectionClass($item))->getShortName();
            $method = str_replace(BaseMenuItem::MENU_ITEM_CLASS_PREFIX, 'build', $shortClass);
            if (!method_exists($this, $method)) {
                $method = self::DEFAULT_RENDER_METHOD;
            }
        } catch (ReflectionException $e) {
            $method = self::DEFAULT_RENDER_METHOD;
        }

        $callable = [$this, $method];
        if (!is_callable($callable)) {
            throw new BadMethodCallException(sprintf('Method %s does not exist', $method));
        }
        $result = call_user_func($callable, $item, $extLabel, $item->getAttributes());
        $result .= !empty($item->getRawHtml()) ? $item->getRawHtml() : '';
        $result .= $item->renderViewElement($this->viewEntity);

        return $result;
    }
650598
protected function renderItem($item)
	{
		if (isset($item['url'])) {
			if($this->useSprites) {
				$spriteUrl = $this->spriteUrl;
				$item['template'] = "<a href=\"{url}\" style=\"background: no-repeat 0 {$this->itemOffset}px url($spriteUrl);\">{label}</a>";
				$this->itemOffset -= 16;
			} else {
				$components = parse_url($item['url']);
				$iconUrl = $this->iconizerBaseUrl . $components['host'];
				$item['template'] = "<a href=\"{url}\" style=\"background: no-repeat url($iconUrl)\">{label}</a>";
			}
		}
		return parent::renderItem($item);
	}
589907
protected function generateMenuItem(ItemInterface $menuItem): Menu
    {
        return new Menu($menuItem, $this->dispatcher, $this->renderer);
    }
290061
public function addItem($item){
		$itemO=$this->getItemToAdd($item);
		$this->addContent($itemO);
		return $itemO;
	}
225116
public static function menuLink($item)
    {
        $app = \JFactory::getApplication();
        $menu = $app->getMenu();
        $item = $menu->getItem($item);

        return \JRoute::_($item->link . '&Itemid=' . $item->id);
    }
1273691
protected function renderItem($item)
    {
        $this->validateItems($item);
        $template = ArrayHelper::getValue($item, 'template', $this->linkTemplate);
        $url = Url::to(ArrayHelper::getValue($item, 'url', '#'));
        if (empty($item['top'])) {
            if (empty($item['items'])) {
                $template = str_replace('{icon}', $this->indItem . '{icon}', $template);
            } else {
                $template = '<a href="{url}" class="kv-toggle">{icon}{label}</a>';
                $openOptions = ($item['active']) ? ['class' => 'opened'] : ['class' => 'opened', 'style' => 'display:none'];
                $closeOptions = ($item['active']) ? ['class' => 'closed', 'style' => 'display:none'] : ['class' => 'closed'];
                $indicator = Html::tag('span', $this->indMenuOpen, $openOptions) . Html::tag('span', $this->indMenuClose, $closeOptions);
                $template = str_replace('{icon}', $indicator . '{icon}', $template);
            }
        }
        $icon = empty($item['icon']) ? '' : '<span class="' . $this->iconPrefix . $item['icon'] . '"></span> &nbsp;';
        unset($item['icon'], $item['top']);
        return strtr($template, [
            '{url}' => $url,
            '{label}' => $item['label'],
            '{icon}' => $icon
        ]);
    }
1258865
protected function buildPostlinkButton(MenuItemPostlinkButton $item, string $postFix = '', array $params = []): string
    {
        if (empty($params['class'])) {
            $params['class'] = 'btn btn-default';
        }

        return $this->buildPostlink($item, $postFix, $params);
    }
1078075
protected static function _getMenuItemObject(array $data): MenuItemInterface
    {
        $itemType = !empty($data['type']) ? $data['type'] : BaseMenuItem::DEFAULT_MENU_ITEM_TYPE;

        $className = __NAMESPACE__ . '\\' . BaseMenuItem::MENU_ITEM_CLASS_PREFIX . ucfirst(Inflector::camelize($itemType));
        $interface = __NAMESPACE__ . '\\' . BaseMenuItem::MENU_ITEM_INTERFACE;

        if (class_exists($className) && in_array($interface, class_implements($className))) {
            return new $className();
        }

        throw new InvalidArgumentException("Unknown menu item type [$itemType]!");
    }
1117046
public function iGoToMenuItem(string $item)
    {
        $adminMenu = $this->admin_page->getMenu();
        $adminMenu->clickMenuItem($item);
    }
1213601
public function addItem(MenuItem $item) {
        if($item instanceof ResourceMenuItem){
            throw new \InvalidArgumentException('ResourceMenuItem passed to Resource::addItem(MenuItem). You cannot nest ResourceMenuItems.');
        }

        $this->items[] = $item;

        return $this;
    }
664332
public function getChildMenuItems(MenuItem $item)
    {
        $results = '';
        foreach ($item->getChilds() as $child) {
            if ($child->hidden()) {
                continue;
            }

            if ($child->hasSubMenu()) {
                $results .= $this->getMultiLevelDropdownWrapper($child);
            } elseif ($child->isHeader()) {
                $results .= $this->getHeaderWrapper($child);
            } elseif ($child->isDivider()) {
                $results .= $this->getDividerWrapper();
            } else {
                $results .= $this->getMenuWithoutDropdownWrapper($child);
            }
        }

        return $results;
    }
816862
protected function buildButton(MenuItemButton $item, string $postFix = '', array $params = []): string
    {
        $params['type'] = 'button';

        if (empty($params['class'])) {
            $params['class'] = 'btn btn-default';
        }

        if (!empty($item->getExtraAttribute())) {
            $params['class'] = $item->getExtraAttribute();
        }

        if (!empty($item->getMenuItems())) {
            $params['data-toggle'] = 'dropdown';
            $params['aria-haspopup'] = 'true';
            $params['aria-expanded'] = 'false';
        }

        $label = $item->getLabel();
        if (!empty($item->getIcon())) {
            $label = '<i class="fa fa-' . $item->getIcon() . '"></i> ' . $label;
        }

        if (!empty($this->format['itemLabelPostfix'])) {
            $label .= ' ' . $this->format['itemLabelPostfix'];
        }

        return $this->viewEntity->Html->tag('button', $label, $params);
    }
892053
public function save(CacheItemInterface $item)
    {
        $metadata = $item->getMetadata();
        $metadata[ 'data' ] = $item->get();

        return wincache_ucache_set($this->prefixKey . $item->getKey(), $metadata, $metadata[ 'ttl' ]);
    }
1204453
public function renderItem($item)
    {
        if (is_string($item)) {
            return $item;
        }
        if (!isset($item['label'])) {
            throw new InvalidConfigException("The 'label' option is required.");
        }
        $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
        $label = $encodeLabel ? Html::encode($item['label']) : $item['label'];
        $options = ArrayHelper::getValue($item, 'options', []);
        $items = ArrayHelper::getValue($item, 'items');
        $url = ArrayHelper::getValue($item, 'url', '#');
        $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);

        //HACK
        $label = "<span>".$label."</span>";
        $icon = isset($item['icon'])?$item['icon']:"";
        if(!empty($icon)){
            $label = "<i class='".$icon."'></i> ".$label;
        }
        $badge = isset($item['badge'])?$item['badge']:"";
        $badgeClass = isset($item['badgeClass'])?$item['badgeClass']:"";
        if(!empty($badge)){
            $label = $label." <small class='badge ".@$badgeClass."'>".$badge."</small>";
        }

        if (isset($item['active'])) {
            $active = ArrayHelper::remove($item, 'active', false);
        } else {
            $active = $this->isItemActive($item);
        }

        if ($items !== null) {
            $linkOptions['data-toggle'] = 'dropdown';
            Html::addCssClass($options, 'treeview');
            Html::addCssClass($linkOptions, 'dropdown-toggle');
            $label .= ' ' . Html::tag('i', '', ['class' => 'fa pull-right fa-angle-left']);
            if (is_array($items)) {
                if ($this->activateItems) {
                    $items = $this->isChildActive($items, $active);
                }
                $items = DropdownSide::widget([
                    'items' => $items,
                    'encodeLabels' => $this->encodeLabels,
                    'clientOptions' => false,
                    'view' => $this->getView(),
                ]);
            }
        }

        if ($this->activateItems && $active) {
            Html::addCssClass($options, 'active');
        }

        return Html::tag('li', Html::a($label, $url, $linkOptions) . $items, $options);
    }
359957
protected function buildLinkModal(MenuItemLinkModal $item, string $extLabel = '', array $params = []): string
    {
        $item->setUrl('#');

        $params['data-toggle'] = 'modal';
        $params['data-target'] = '#' . $item->getModalTarget();

        return $this->buildLink($item, $extLabel, $params);
    }
554324
public function editMenuItemLabelAction(MenuItemLabel $menuItemlabel)
    {
        $em = $this->getDoctrine()->getManager();

        if (!$menuItemlabel) {
            throw $this->createNotFoundException('Unable to find MenuItem entity.');
        }
        $editForm = $this->createForm($this->get("amulen.page.form.menuitemlabel"), $menuItemlabel, array(
            'action' => $this->generateUrl('admin_menu_item_label_update', array('id' => $menuItemlabel->getId())),
            'method' => 'PUT',
        ));
        $editForm->add('submit', 'submit', array('label' => 'Update'));

        return array(
            'entity' => $menuItemlabel,
            'form' => $editForm->createView(),
        );
    }
947100
protected function buildLinkButtonModal(MenuItemLinkButtonModal $item, string $extLabel = '', array $params = []): string
    {
        $item->setUrl('#');

        if (empty($params['class'])) {
            $params['class'] = 'btn btn-default';
        }

        return $this->buildLinkModal($item, $extLabel, $params);
    }