As JSubmenuHelper is deprecated, how to migrate to JHtmlSidebar?

by YoKoGFX   Last Updated October 15, 2019 09:10 AM - source

The only source I found about this is from this post: Replacing JSubmenuHelper with JHtmlSidebar / Administrative menu in Joomla 4

The issue here is that I tried it, and it doesn't show the Sidebar if I try it with JHtmlSidebar.

Here is the Code:

public function render($config = array())
    $config = new KObjectConfigJson($config);
        'toolbar' => null

    foreach ($config->toolbar->getCommands() as $command)
        if(!empty($command->href)) {
            $command->href = $this->getTemplate()->route($command->href);

        JSubmenuHelper::addEntry($this->getObject('translator')->translate($command->label), $command->href, $command->active);


    return '';

In this, JSubmenuHelper::addEntry should be replaced with the JHtmlSidebar function.

I tried to change the line to

JHtmlSidebar::addEntry($this->getObject('translator')->translate($command->label), $command->href, $command->active);

and to

JHtmlSidebar::render($this->getObject('translator')->translate($command->label), $command->href, $command->active);

but on with addEntry the sidebar is hidden and with render() there is no content in it.

What is wrong with the attempts that I already tried?

Related Questions

Upgrade joomla 1.5 to 3.x

Updated March 14, 2017 10:10 AM

Migrate from opencart to joomla

Updated February 19, 2019 18:10 PM

Update Joomla from 2.5.28 to 3.4.0

Updated August 09, 2016 08:04 AM