I have a custom component that will be using various AJAX calls, based on outside settings.
How can I load "this" controller from the View or Model to determine if a method/function exists, i.e. PHP method_exists
and/or is_callable
;
I have a custom component that will be using various AJAX calls, based on outside settings.
How can I load "this" controller from the View or Model to determine if a method/function exists, i.e. PHP method_exists
and/or is_callable
;
I never figured out how to use $this
, but it was pretty straightforward otherwise. This checks to see if the add
method exists in the Article controller.
$ToolsClass = 'ContentControllerArticle';
$methodToFind = 'add';
JLoader::register($ToolsClass, JPATH_SITE . '/components/com_content/controllers/article.php');
if (!method_exists($ToolsClass, $methodToFind)){
echo "Content Controller Function '{$methodToFind}' not found";
}