Finder:Index - Call To Undefined Method Joomla\CMS\Application\ConsoleApplication::getTemplate() - Question | JoomShaper

Finder:Index - Call To Undefined Method Joomla\CMS\Application\ConsoleApplication::getTemplate()

B

BITS

SP Page Builder 1 day ago

If you update the finder index via CLI it will result in an error if SP Page Builder Finder Plugin is enabled.

The only solution is currently to disable the plugin completly. This whole thing cannot work, CLI does not have functions for getTemplate, getMenu and so on...

Simple code solution would be:

helper.php:

    public static function loadLanguage($forceLoad = false)
    {
        $lang = Factory::getLanguage();

        /** @var CMSApplication */
        $app = Factory::getApplication();
        $template = $app->getTemplate();

        if ($app->isClient('administrator')) {
            $template = self::getTemplate();
        }
                ...

change to:

    public static function loadLanguage($forceLoad = false)
    {
        $lang = Factory::getLanguage();
        $app = Factory::getApplication();

        if($app instanceof ConsoleApplication || $app->isClient('administrator')) {
            $template = self::getTemplate();
        } else
        {
            $template = $app->getTemplate();
        }
        ...

Here is the stacktrace of the error...

In helper.php line 1588:

[Error]
Call to undefined method Joomla\CMS\Application\ConsoleApplication::getTemplate()

Exception trace:

at ROOTFOLDER\components\com_sppagebuilder\helpers\helper.php:1588 SppagebuilderHelperSite::loadLanguage() at ROOTFOLDER\components\com_sppagebuilder\helpers\helper.php:93 SppagebuilderHelperSite::prepareAddonFieldStructures() at ROOTFOLDER\components\com_sppagebuilder\helpers\helper.php:1039 SppagebuilderHelperSite::sanitize() at ROOTFOLDER\administrator\components\com_sppagebuilder\editor\helpers\ApplicationHelper.php:73 ApplicationHelper::sanitizePageText() at ROOTFOLDER\components\com_sppagebuilder\helpers\helper.php:1729 SppagebuilderHelperSite::getPrettyText() at ROOTFOLDER\plugins\finder\sppagebuilder\sppagebuilder.php:204 PlgFinderSppagebuilder->index() at ROOTFOLDER\administrator\components\com_finder\src\Indexer\Adapter.php:261 Joomla\Component\Finder\Administrator\Indexer\Adapter->onBuildIndex() at ROOTFOLDER\libraries\src\Plugin\CMSPlugin.php:311 Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin{closure}() at ROOTFOLDER\libraries\vendor\joomla\event\src\Dispatcher.php:454 Joomla\Event\Dispatcher->dispatch() at ROOTFOLDER\libraries\src\Application\EventAware.php:111 Joomla\CMS\Application\ConsoleApplication->triggerEvent() at ROOTFOLDER\libraries\src\Console\FinderIndexCommand.php:400 Joomla\CMS\Console\FinderIndexCommand->index() at ROOTFOLDER\libraries\src\Console\FinderIndexCommand.php:212 Joomla\CMS\Console\FinderIndexCommand->doExecute() at ROOTFOLDER\libraries\vendor\joomla\console\src\Command\AbstractCommand.php:234 Joomla\Console\Command\AbstractCommand->execute() at ROOTFOLDER\libraries\vendor\joomla\console\src\Application.php:1083 Joomla\Console\Application->runCommand() at ROOTFOLDER\libraries\vendor\joomla\console\src\Application.php:374 Joomla\Console\Application->doExecute() at ROOTFOLDER\libraries\src\Application\ConsoleApplication.php:201 Joomla\CMS\Application\ConsoleApplication->doExecute() at ROOTFOLDER\libraries\vendor\joomla\console\src\Application.php:413 Joomla\Console\Application->execute() at ROOTFOLDER\libraries\src\Application\ConsoleApplication.php:255 Joomla\CMS\Application\ConsoleApplication->execute() at ROOTFOLDER\cli\joomla.php:77

0
1 Answers
Ofi Khan
Ofi Khan
Accepted Answer
Support Agent 16 hours ago #220761

Hello BITS,

Thank you for reaching out to our technical support forum. I’m sorry to hear about the trouble you’re experiencing.

I will share the issue with the developer team and they will check it.

Best regards

0