Call to a member function getX() on null
banglashi opened this issue · 3 comments
Hi @jonom,
first of all thanks for the great module.
I noticed a weird error wich I get in the cms when opening a single view of a file Call to a member function getX() on null
. When you create the FocusPointField you pass in 3 parameters, $name, $title and $image. On the title you pass in $image->fieldLabel('FocusPoint') which translates to "Focus point".
Later you $this->setName
and after you call
parent::__construct
passing $title and $fields.Somehow the name doesn't get set properly (check how FieldGroup handles it) and later on getSchemaStateDefaults when you do $this->getName()
it returns Focuspoint
but it actually should return FocusPoint
That's why it gets a null reference and fails when trying to getX() on it. Let me know if you have any more questions.
Best regards
Can you try the dev-master branch? The same error was reported previously and hopefully fixed, but it hasn't been released yet.
dev-master works. Thanks.
From my understanding this issue is not resolved (using the latest 3.1.3 release). It only happens if the field label resolves to something different from "Focus Point". From my limited testing it should be sufficient if the parent constructor of FocusPointField is called prior setting name and value.