0
votes

I try to get the Releasemaker from Akeeba running and set the language for a release/item to All (*). But one can assume that this kind of problem should happen to any kind of code which tries to set a database field language using code in the Site folder.

If you have a multilingual site you probably have the plugin "System - Language Filter" running. This plugin sets a $_REQUEST['language'] value to a specific language. Every time. As a result code like $data = $app->input->getData() will get the language value of that $_REQUEST value instead of the value from the $_POST array so you can't set that language field with the usual ->bind($data) operation.

Did you encountered that issue as well? What is your solution for this?

1

1 Answers

0
votes

I got myself a solution for this. I actually can imaging two ways to solve this. On the one hand you can rename the language parameter which is transferred from the client to the server and do magic stuff in the persistent layer. On the other hand you can try to fix the work of the language filter plugin. Since I don't want to change the component I chose the second way and added a system plugin to reset the language value in the request to * as I need it. Of course one can read that value from the POST data as well. The plugin is as strict as possible where to do that magic to not crash the other stuff.

class PlgSystemLanguagefixer extends JPlugin
{

    public function onAfterRoute() {
        // Get the application object.
        $app = JFactory::getApplication();

        $option = $app->input->get('option');
        $format = $app->input->get('format');
        $task = $app->input->get('task');
        $view = $app->input->get('view');

        if ($option == 'com_ars' && $task=='save' && $format == 'json' && ($view=='releases' || $view='items')) {
            $app->input->set('language', '*');
        }


    }
}

Please note that this question is still open for better answers :)