src/View/Helper/MenuHelper.php
protected function _renderLink($item, $level)
    {
        $templater = $this->templater();

        if ($item['icon'] ?? false) {
            $attrs = [
                'class' => [
                    $this->config('iconClass'),
                    $item['icon']
                ]
            ];

            $icon = $this->formatTemplate('icon', [
                'attrs' => $templater->formatAttributes($attrs)
            ]);
        } else {
            $icon = null;
        }

        if ($item['name_short'] ?? false) {
            $attrs = [
                'class' => $this->config('nameShortClass')
            ];
            $shortName = $this->formatTemplate('name', [
                'attrs' => $templater->formatAttributes($attrs),
                'shortName' => $item['name_short']
            ]);
        } else {
            $shortName = null;
        }

        if ($item['name'] ?? false) {
            $attrs = [
                'class' => $this->config('nameClass')
            ];
            $name = $this->formatTemplate('name', [
                'attrs' => $templater->formatAttributes($attrs),
                'name' => $item['name']
            ]);
        } else {
            $name = null;
        }

        if ($this->_hasChildren($item)) {
            $attrs = [
                'class' => $this->config('caretClass')
            ];
            $caret = $this->formatTemplate('caret', [
                'attrs' => $templater->formatAttributes($attrs)
            ]);
        } else {
            $caret = null;
        }

        $linkContent = $this->formatTemplate('linkContent', compact('icon', 'shortName', 'name', 'caret'));
        $options = [
            'class' => $this->_buildLinkClasses($level),
            'escape' => false
        ];

        if (isset($item['url']) && !empty($item['url'])) {
            return $this->Guardian->protectedLink($linkContent, $item['url'], $options);
        }

        return $this->Html->link($linkContent, 'javascript:void(0)', $options);
    }
protected function _renderLink($item, $level)
    {
        $templater = $this->templater();

        if ($item['icon'] ?? false) {
            $attrs = [
                'class' => [
                    $this->config('iconClass'),
                    $item['icon']
                ]
            ];

            $icon = $this->formatTemplate('icon', [
                'attrs' => $templater->formatAttributes($attrs)
            ]);
        } else {
            $icon = null;
        }

        if ($item['name_short'] ?? false) {
            $attrs = [
                'class' => $this->config('nameShortClass')
            ];
            $shortName = $this->formatTemplate('name', [
                'attrs' => $templater->formatAttributes($attrs),
                'shortName' => $item['name_short']
            ]);
        } else {
            $shortName = null;
        }

        if ($item['name'] ?? false) {
            $attrs = [
                'class' => $this->config('nameClass')
            ];
            $name = $this->formatTemplate('name', [
                'attrs' => $templater->formatAttributes($attrs),
                'name' => $item['name']
            ]);
        } else {
            $name = null;
        }

        if ($this->_hasChildren($item)) {
            $attrs = [
                'class' => $this->config('caretClass')
            ];
            $caret = $this->formatTemplate('caret', [
                'attrs' => $templater->formatAttributes($attrs)
            ]);
        } else {
            $caret = null;
        }

        $linkContent = $this->formatTemplate('linkContent', compact('icon', 'shortName', 'name', 'caret'));
        $options = [
            'class' => $this->_buildLinkClasses($level),
            'escape' => false
        ];

        if (isset($item['url']) && !empty($item['url'])) {
            return $this->Guardian->protectedLink($linkContent, $item['url'], $options);
        }

        return $this->Html->link($linkContent, 'javascript:void(0)', $options);
    }
protected function _renderLink ( $ item , $ level ) { $ templater = $ this -> templater ( ) ; if ( $ item [ 'icon' ] ?? false ) { $ attrs = [ 'class' => [ $ this -> config ( 'iconClass' ) , $ item [ 'icon' ] ] ] ; $ icon = $ this -> formatTemplate ( 'icon' , [ 'attrs' => $ templater -> formatAttributes ( $ attrs ) ] ) ; } else { $ icon = null ; } if ( $ item [ 'name_short' ] ?? false ) { $ attrs = [ 'class' => $ this -> config ( 'nameShortClass' ) ] ; $ shortName = $ this -> formatTemplate ( 'name' , [ 'attrs' => $ templater -> formatAttributes ( $ attrs ) , 'shortName' => $ item [ 'name_short' ] ] ) ; } else { $ shortName = null ; } if ( $ item [ 'name' ] ?? false ) { $ attrs = [ 'class' => $ this -> config ( 'nameClass' ) ] ; $ name = $ this -> formatTemplate ( 'name' , [ 'attrs' => $ templater -> formatAttributes ( $ attrs ) , 'name' => $ item [ 'name' ] ] ) ; } else { $ name = null ; } if ( $ this -> _hasChildren ( $ item ) ) { $ attrs = [ 'class' => $ this -> config ( 'caretClass' ) ] ; $ caret = $ this -> formatTemplate ( 'caret' , [ 'attrs' => $ templater -> formatAttributes ( $ attrs ) ] ) ; } else { $ caret = null ; } $ linkContent = $ this -> formatTemplate ( 'linkContent' , compact ( 'icon' , 'shortName' , 'name' , 'caret' ) ) ; $ options = [ 'class' => $ this -> _buildLinkClasses ( $ level ) , 'escape' => false ] ; if ( isset ( $ item [ 'url' ] ) && ! empty ( $ item [ 'url' ] ) ) { return $ this -> Guardian -> protectedLink ( $ linkContent , $ item [ 'url' ] , $ options ) ; } return $ this -> Html -> link ( $ linkContent , 'javascript:void(0)' , $ options ) ; }
Render the link of the menu item.

@param array $item The menu item.
@param int $level The current nesting level.
@return string
Render the link of the menu item .