18 votes
Accepted

What is getContent() / the ContentModel, and how do I use it to get and set custom field values?

BaseElementModel::getContent() will return the element’s ContentModel. It has two purposes: To store the element’s data from the craft_content table table when fetching elements from the DB. To store ...
user avatar
3 votes

Why does my custom element type error around locale being missing on the element types' model?

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 ...
user avatar
  • 6,637
2 votes

Does defineSearchableAttributes() work with getter methods on the model?

I have since discovered that searching on a related model is fairly easy to implement. You just define the related model as an attribute that can be searched on in defineSearchableAttributes method of ...
user avatar
1 vote

Why is ElementsService forgiving of an element type whose populateElementModel() method doesn’t return an actual element model

Someone requested it. They had a use case for it where they couldn’t simply prevent the rows from getting selected in the DB query with a conditional (which is still definitely the recommended way to ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible