Jump to content

How to get default language


Recommended Posts

Hi, I cannot find this simple information anywhere.

I am writing a module and want to get default language id.

 

My getContent method looks like that (part of code):

public function getContent()
{		
    $output = null;
		
    if(Tools::isSubmit('addregfield'))
    {
	//display for for the user so he can enter data
        return $output.$this->displayForm(); //here I get actual lang id using (int)Configuration::get('PS_LANG_DEFAULT');
    }
		
    if (Tools::isSubmit('addfield'.$this->name)) //form after submit
    {        	
       //here Configuration::get('PS_LANG_DEFAULT') ALWAYS returns NULL    
    }
}

As you can see if form was submitted, Configuration ALWAYS returns NULL. Why is that? I'm fighting with it for 2 hours. And the only thing I came up with was to create hidden field in my form (using HelperForm) and then read this value. But I'm nearly sure that this method is bad. So, how to do this properly?

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...