Skip to content

ClassNotFoundError Template One after upgrade to Joomla 5 #597

@udospr

Description

@udospr

Hi,
I updated Astroid and Tempate One to version 3.0.11 and upgraded Joomla to version 5.0.3
This results in an error when the Backwards Compatibility plugin is unpublished.
Class "JHtml" not found
Location: JROOT\templates\astroid_template_one\html\mod_menu\default_component.php:43

The lines 34-50 of this file are:

if ($item->menu_image)
{
	if ($item->menu_image_css)
	{
		$image_attributes['class'] = $item->menu_image_css;
		$linktype = JHtml::_('image', $item->menu_image, $item->title, $image_attributes);
	}
	else
	{
		$linktype = JHtml::_('image', $item->menu_image, $item->title);
	}

	if ($item->getParams()->get('menu_text', 1))
	{
		$linktype .= '<span class="image-title">' . $item->title . '</span>';
	}
}

When using a child template of Temple One I get this in the stack trace

Symfony\Component\ErrorHandler\Error\ClassNotFoundError:
Attempted to load class "JHtml" from the global namespace.
Did you forget a "use" statement?

at C:\xampp\htdocs\stenen\templates\astroid_template_one\html\mod_menu\default_component.php:43

When I comment out lines 41-44 (else ..... } ) the problem is gone.

How to solve this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Joomla 5Related to Joomla 5SOLVED!bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions