0

I want to change classes nav item with my own classes for customer account dashbaord navigation. What's the best way to do this?

This is the core file which creates the classes.

Magento\Framework\View\Element\Html\Link\Current.php

        if (false != $this->getTemplate()) {
        return parent::_toHtml();
    }

    $highlight = '';

    if ($this->getIsHighlighted()) {
        $highlight = ' current';
    }

    if ($this->isCurrent()) {
        $html = '<li class="nav item current">';
        $html .= '<strong>'
            . $this->escapeHtml((string)new \Magento\Framework\Phrase($this->getLabel()))
            . '</strong>';
        $html .= '</li>';
    } else {
        $html = '<li class="nav item' . $highlight . '"><a href="' . $this->escapeHtml($this->getHref()) . '"';
        $html .= $this->getTitle()
            ? ' title="' . $this->escapeHtml((string)new \Magento\Framework\Phrase($this->getTitle())) . '"'
            : '';
        $html .= $this->getAttributesHtml() . '>';

        if ($this->getIsHighlighted()) {
            $html .= '<strong>';
        }

        $html .= $this->escapeHtml((string)new \Magento\Framework\Phrase($this->getLabel()));

        if ($this->getIsHighlighted()) {
            $html .= '</strong>';
        }

        $html .= '</a></li>';
    }

    return $html;
}
0

You can use below code

if (false != $this->getTemplate()) {
        return parent::_toHtml();
    }

    $highlight = '';

    if ($this->getIsHighlighted()) {
        $highlight = ' current';
    }

    if ($this->isCurrent()) {
        $html = '<li class="custom current">';
        $html .= '<strong>'
            . $this->escapeHtml((string)new \Magento\Framework\Phrase($this->getLabel()))
            . '</strong>';
        $html .= '</li>';
    } else {
        $html = '<li class="custom' . $highlight . '"><a href="' . $this->escapeHtml($this->getHref()) . '"';
        $html .= $this->getTitle()
            ? ' title="' . $this->escapeHtml((string)new \Magento\Framework\Phrase($this->getTitle())) . '"'
            : '';
        $html .= $this->getAttributesHtml() . '>';

        if ($this->getIsHighlighted()) {
            $html .= '<strong>';
        }

        $html .= $this->escapeHtml((string)new \Magento\Framework\Phrase($this->getLabel()));

        if ($this->getIsHighlighted()) {
            $html .= '</strong>';
        }

        $html .= '</a></li>';
    }

    return $html;

enter image description here

  • @Sondre is that working for you ? – hweb87 Apr 30 '18 at 5:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.