18

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 the POST data that should be stored in the craft_content table when saving an element to the DB. In both cases, the ContentModel should not actually be ...


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() { ...


2

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 the element type. For example: /** * @inheritDoc IElementType::defineSearchableAttributes() * * @return array */ public function ...


1

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 go). The only reason I decided to add it was for the sake of defensive coding.


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