2

I have made numerous elementTypes in my plugin that all work perfectly but for some reason one elementType keeps having an error when trying to view the Model's content or custom fields.

This is the error:

Property "Craft\Myplugin_OrderModel.locale" is not defined.

Everything looks exactly the same as all the other models that are elementTypes in my plugin.

All my plugins elementType models are using

public function isLocalized()
{
    return false;
}

but the issue still persists with that one Model.

3

That's interesting Luke, I had the exact same issue and spent WAY too long on it.

Even though I used a diff tool to see the difference between working elementType models and the one with the error I just did not catch the silly difference:

protected function defineAttributes()
{
    return array(

vs the working:

protected function defineAttributes()
{
    return array_merge(parent::defineAttributes(), array(

you need to add the parent attributes that includes attributes like locale :)

I knew that all along, but just didn't catch it on multiple re-reviewing of the Model.

| improve this answer | |
  • 1
    lol - it's a good thing you were here to help answer the question. – Brad Bell Feb 4 '15 at 4:47
  • 1
    I was the hero l needed, not the one I deserved. – Luke Holder Feb 4 '15 at 4:52
  • 1
    Luke, I heard Luke also had this issue. Maybe you should ping him! =) – Ben Parizek Feb 4 '15 at 7:26
  • thought this might be helpful @LukeHolder – Luke Holder Feb 4 '15 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.