Question

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
Was it helpful?

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();
}

OTHER TIPS

Did you activate the FormHelper in the AppController?

App::uses('FormHelper', 'View/Helper'); // Don't forget this one in Cake 2.x

class AppController extends Controller
{
  public
    $helpers = array('Form');
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top