<?php
/**
 * Webkul Software.
 *
 * @category  Webkul
 * @package   Webkul_Agorae
 * @author    Webkul
 * @copyright Copyright (c) Webkul Software Private Limited (https://webkul.com)
 * @license   https://store.webkul.com/license.html
 */
namespace Webkul\Agorae\Block\View\Element\Html\Link;

/**
 * Agorae Block View Element Html Link Current
 */
class Current extends \Magento\Framework\View\Element\Html\Link\Current
{
    /**
     * Get href URL
     *
     * @return string
     */
    public function getHref()
    {
        return $this->getPath();
    }

    /**
     * Render block HTML
     *
     * @return string
     */
    protected function _toHtml()
    {
        if (false != $this->getTemplate()) {
            return parent::_toHtml();
        }
        $highlight = '';

        if ($this->getIsHighlighted()) {
            $highlight = ' current';
        }
        if ($this->isCurrent()) {
            $html = '<li class="nav item current '.$this->getAgoraeFollow().'">';
            $html .= '<strong>'
                . $this->escapeHtml((string)new \Magento\Framework\Phrase($this->getLabel()))
                . '</strong>';
            $html .= '</li>';
        } else {
            $html = '<li class="nav item' ." ".$this->getAgoraeFollow()
            . $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;
    }
}
