Search code examples
cakephpformhelper

Cakephp country helper


I have a problem with this helper : https://github.com/kshakirov/cakephp-lang-helper

This helper give me this error and I don't find why :

Fatal Error

Error: Call to a member function input() on a non-object
File: \app\View\Helper\LangHelper.php
Line: 670

Solution

  • I am guessing the problem is that LangHelper overrides the parent __construct method, preventing Cake from setting up the Helper correctly. Change LangHelper's __construct() to the following:

    public function __construct(View $View, $settings = array()) {
        parent::__construct($View, $settings); 
        $this->mapper = $this->parseLangHeaders();
        $this->langCode = $this->findLangCode();
        $this->countryCode = $this->findCountryCode();
    }