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);
$config->append(array(
'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?