1

I have to migrate some files and functions from Joomla 3 to 4. A former colleague had add custom extensions to the J3 CMS. I don't know exactly what I'm doing wrong. I'm trying to add a submenu to a component admin view in the backend using a helper file.

What I've done:

  • Create a file in administrator/components/mycomp/src/Helper/myhelper.php
<?php namespace MySpace\Module\MyComp\Administrator\Helper; 
defined('_JEXEC') or die;
class MyhelperHelper extends JHelperContent
{
    public static function addSubmenu($vName)
    {
        JHtmlSidebar::addEntry(
            '<i class="icon-home"></i> ' . JText::_('some_text'),
            'index.php?option=com_mycomp',
                        $vName == 'myview'
  • In the mycomp HtmlView.php I add some lines:
myhelperHelper::addSubmenu('myview');$this->sidebar = JHtmlSidebar::render();
  • In default.php:
<div id="j-sidebar-container" class="span2"><?php echo $this->sidebar; ?></div>
  • in services/provider.php:
$container->registerServiceProvider(new HelperFactory('\\MySpace\\Module\\Mycomp\\Administrator\\Helper'));

Error: Class "MySpace\Component\Mycomp\Administrator\View\MyComp\MyhelperHelper" not found

Unfortunaly, there are not many well written guides to J4 especially when you are new in Joomla 4. Maybe someone has a recommendation or solution. Thanks.

1 Answers1

0

That submenu is removed in Joomla 4 so you safely remove it in your component. If you still want to have similar submenu, you need to build and render it in your own way.

Hung Tran
  • 790
  • 2
  • 8
  • 24