Questions tagged [contentmodel]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3
votes
1answer
723 views

Are categories the best way to organize Commerce product filters?

The Commerce site I'm working on (my first Craft project) will have a product listing page with filters. These will function as you would expect, but clicking a filter name will link to another ...
7
votes
1answer
979 views

One structure vs a structure per section?

I'm new to Craft CMS and I would appreciate some advice re the best approach to take for modelling content. I'm coming from an ExpressionEngine background, where I would typically use one pages ...
3
votes
1answer
167 views

Why does field value get updated on $element->getContent()->fieldHandle but not when accessed directly $element->fieldHandle?

I am trying to update a custom field on an EntryModel. I'm having half success, and I don't understand why. I've looked at other posts such as this one by Brandon which discuss how to assign these ...
1
vote
1answer
2k views

Modelling flexible content sections and recommendations

A little background first; I'm coming from WordPress, along with the Advanced custom fields (ACF) plugin, so my thinking behind this may not be the best way in Craft. In ACF I usually set up a field ...
1
vote
1answer
63 views

Architecting a Solution with many Sites within a Site (Chapters) - How many sections can Craft Handle?

I am working on a plan for a site build that includes national content as well as many chapters' content. The latter has a number of requirements that are leading me to using separate sections ...
15
votes
1answer
3k views

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

If I want to retrieve content on an element, should I be calling $entry->$fieldHandle or $entry->getContent()->$fieldHandle? What’s the difference? Likewise, if I’m setting new content on an ...
2
votes
1answer
481 views

Can someone help me identify why my entry is invalidating?

I have a custom plugin that's saving an entry successfully. While saving the entry I'm setting our "merchant" field (an entries field, limit=1) like so: <?php # ... $entry = newEntryModel(); # set ...