You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While hacking on an existing module, I thought it would be able nice to add an Ajax method to proxy an existing one, For example:
public function getAjax()
{
// Proxy an existing method, maybe used elsewhere, for Ajax.
return $this->getFoo();
}
public function getFoo()
{
// A whole bunch of code normally goes here for stuff written some time ago
return 'foo;
}
While hacking on an existing module, I thought it would be able nice to add an Ajax method to proxy an existing one, For example:
But, this doesn't work as we'll get a
Fatal error: Using $this when not in object contextdue to https://github.com/Joomla-Ajax-Interface/component/blob/master/site/ajax.php#L90.We could check to see if that method is static, then call it like the following if not:
$helperClass = new $class; $results = call_user_func($helperClass . '->' . $method . 'Ajax');But, this may have an issue if we don't pass any required parameters when instantiating the class.
Thoughts?