New answers tagged

0

After a bit of testing, it appears you don't have anything to do to have your values saved, just set them and Craft will take care of the rest. Event::on( Elements::class, Elements::EVENT_BEFORE_SAVE_ELEMENT, static function (ElementEvent $event) { $element = $event->element; if ($element instanceof ...


1

Here's how I would approach this... {% set classBlocks = entry.classBlocks.all() %} {% if classBlocks | length %} {% set instructors = classBlocks | filter(block => block.type == 'instructors') %} by <strong>{{ instructors | map(instructor => instructor.fullName) | join(', ', ', and ') }}</strong> {% endif %} We're using several ...


1

I haven't tested this, but I think .sum() will execute your query, so put it at the end: {% set reimbursementAmount = craft.matrixBlocks() .relatedTo(cat) .fieldId(9) .specialCase(':empty:') .sum('field_item_reimbursementAmount') %}


1

Here's my article that described possible solutions to this problem: http://craftsnippets.com/articles/matrix-within-a-matrix-possible-solutions-for-craft-cms


Top 50 recent answers are included