Back to LegacyComponent class

Method loadHelper

private bool|string
loadHelper
()
Returns the classname of the legacy helper class. If none is found it returns false.
Returns
  • bool|string
Since
  • 4.0.0

Method loadHelper - Source code

/**
 * Returns the classname of the legacy helper class. If none is found it returns false.
 *
 * @return  boolean|string
 *
 * @since   4.0.0
 */
private function loadHelper()
{
    $className = ucfirst($this->component) . 'Helper';
    if (class_exists($className)) {
        return $className;
    }
    $file = Path::clean(JPATH_ADMINISTRATOR . '/components/com_' . $this->component . '/helpers/' . $this->component . '.php');
    if (!is_file($file)) {
        return false;
    }
    \JLoader::register($className, $file);
    if (!class_exists($className)) {
        return false;
    }
    return $className;
}