I'm trying to override a class JMenuSite in libraries/cms/menu/site.php
. I created a plugin system jmenusite.php
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
class plgSystemJmenusite extends JPlugin{
public function onAfterRoute () {
require_once(JPATH_SITE.'/plugins/system/jmenusite/site.php');
}
}
?>
I copied the files site.php
in the folder of the plugin.
Joomla performs the original class and then gives me error:
Fatal error: Cannot redeclare class JMenuSite
How can I override the existing class?