I'm working with a CMS, Joomla, and there's a core class which renders a set of parameters to a form, JParameter. Basically it has a render()
function which outputs some table-laden HTML which is not consistent with the rest of my site.
For issues of maintainability, and because I have no idea where else this is being used, I don't want to change the core code. What would be ideal would to be able to define a new class which extends JParameter and then cast my $params object down to this new sub class.
// existing code --------------------
class JParameter {
function render() {
// return HTML with tables
}
// of course, there's a lot more functions here
}
// my magical class -----------------
class MyParameter extends JParameter {
function render() {
// return HTML which doesn't suck
}
}
// my code --------------------------
$this->params->render(); // returns tables
$this->params = (MyParameter) $this->params; // miracle occurs here?
$this->params->render(); // returns nice html