fritzmg / contao-sharebuttons

Simple extension to provide share buttons as a module and content element in Contao
GNU Lesser General Public License v3.0
18 stars 2 forks source link

Extension doesn't work with Contao 4.8 #41

Closed syntaxys closed 5 years ago

syntaxys commented 5 years ago

There is a bug in combination with Contao >= 4.8.2 Argument 2 passed to Contao\Controller::getTemplateGroup() must be of the type array, string given, called in /path/to/contao/vendor/fritzmg/contao-sharebuttons/system/modules/sharebuttons/classes/ShareButtons.php on line 367

Changing the code like this will fix it:

    ...
    public function getSharebuttonsTemplates(DataContainer $dc)
    {
        // $intPid = $dc->activeRecord->pid;
        $intPid = array($dc->activeRecord->pid);

        if (\Input::get('act') == 'overrideAll')
        {
            // $intPid = \Input::get('id');
            $intPid = array(\Input::get('id'));
        }

        return \Controller::getTemplateGroup('sharebuttons_', $intPid);
    }
fritzmg commented 5 years ago

Not sure why I put that even in. That function doesn't take any parameters, neither in Contao 3, nor 4 (or used to).

fritzmg commented 5 years ago

Fixed via 6da9a12 and released as 2.1.2.