JMENU-ABSTRACT-001
class MyMenu extends JMenu
JMenu is abstract — you must implement load()
JMenu became AbstractMenu. Subclasses that do not implement load() are abstract and fatal.
class MyMenu extends JMenu → Extend AbstractMenu and implement load()
What you will see
- Class LmsMenu contains 1 abstract method
- Cannot instantiate abstract class
Symptoms people search
menu class abstract · JMenu load()
Replace this code
Swap class MyMenu extends JMenu for Extend AbstractMenu and implement load().
Joomla 3
Remove or stop calling this
class LmsMenu extends JMenu {
// Joomla 3 allowed incomplete subclasses
}Joomla 4 / 6
Use this instead
class LmsMenu extends \Joomla\CMS\Menu\AbstractMenu {
public function load() { /* return items */ return true; }
}How to fix it
- 1Implement load().
- 2Use the namespaced AbstractMenu.
Also known as
AbstractMenu · JMenu load · doExecute
Related issues
- Joomla 3 → 4Joomla API
JRequest::getVar() and the whole JRequest API
JRequest::getVar() → $app->getInput()->get('id')
- Joomla 3 → 4Joomla API
JError / JException
JError::raiseError() → throw new RuntimeException() / try-catch
- Joomla 3 → 4Joomla API
isAdmin() / isSite()
$app->isAdmin() → $app->isClient('administrator') / isClient('site')
- Joomla 3 → 4Joomla API
Factory::getUri()
JFactory::getUri() → Uri::getInstance()
- Joomla 3 → 4Joomla API
Factory::getXml() / JXMLElement
JFactory::getXML() → SimpleXMLElement
- Joomla 3 → 4Joomla API
Factory::getEditor()
JFactory::getEditor() → Editor::getInstance()