1

I want to set my custom div on my custom Brands link in Top Menu like enter image description here I create my custom link in Top Menu the code is

<?php

namespace Vender\Module\Plugin\Block;

use Magento\Framework\Data\Tree\NodeFactory;

class Topmenu
{
    /**
     * @var NodeFactory
     */
    protected $nodeFactory;

    public function __construct(
        NodeFactory $nodeFactory,
        \Magento\Store\Model\StoreManagerInterface $storeManager,
        Data $helper
    )
    {
        $this->nodeFactory = $nodeFactory;
        $this->_storeManager=$storeManager;
        $this->_helper = $helper;
    }

    public function beforeGetHtml(
        \Magento\Theme\Block\Html\Topmenu $subject
    )
    {
        $node = $this->nodeFactory->create(
            [
                'data' => $this->getNodeAsArray(),
                'idField' => 'id',
                'tree' => $subject->getMenu()->getTree()
            ]
        );
        $subject->getMenu()->addChild($node);
    }

    protected function getNodeAsArray()
    {
            return [
                'name' => __('Brands'),
                'id' => 'pmebrands',
                'url' => $this->_storeManager->getStore()
                        ->getBaseUrl().'shop-bybrand.html',
                'has_active' => false,
                'is_active' => false
            ];


    }
}

now the code is showing the link perfectly on top menu but the problem is how can I set my custom div to show on my custom link Brands mouse hover?

Your Answer

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

Browse other questions tagged or ask your own question.