3

You are asking about Twig's operator precedence: The operator precedence is as follows, with the lowest-precedence operators listed first: ?: (ternary operator), b-and, b-xor, b-or, or, and, ==, !=, <=>, <, >, >=, <=, in, matches, starts with, ends with, .., +, -, ~, *, /, //, %, is (tests), **, ??, | (filters), [], and .: | is higher ...


3

There might be other ways, but here's one possibility: {{ craft.app.fields.getFieldByHandle('yourFieldHandle').className() }} This will return a string of craft\fields\PlainText, craft\fields\Lightswitch etc, which you can then use in conditionals/switch statements.


2

You're looking for the filter filter: https://docs.craftcms.com/v3/dev/filters.html#filter Specifically something like this (untested): {% set activeChildren = children|filter(child => child.associatedTerm|length) %} {% set inactiveChildren = children|filter(child => child.associatedTerm|length == 0) %} You now have two unique arrays to do with as you ...


2

The only way to do this is to create multiple entry types for your structure section. Each entry type has its own field layout (can have different fields from the other entry types in that section). Sadly, it's not possible to restrict entry types to a particular level in a structure – i.e. if you create "Landing Page" and "Sub Page" ...


2

Marion's answer beat me to this while I was writing but it's essentially very similar. Replace raw with, say, upper and you'll be able to visually see what's going on: // {{ entry.maxWidth|length ? 'max-width: '|raw ~ entry.maxWidth ~ 'px;'|raw : 'max-width: unset;'|raw }} MAX-WIDTH: 160PX; // {{ entry.maxWidth|length ? 'max-width: ' ~ entry.maxWidth ~ 'px;'...


2

How about doing something like this? {% set style = entry.maxWidth|length ? entry.maxWidth ~ 'px' : 'unset' %} {{ style|raw }}


1

Having done some further testing and research I believe this is a case of having to merge two date objects and ensuring that these are set as date/time objects when merging them into a variable. Here are some examples way: {% set thisWeeksDayAndTime = thisWeeksDay|date() ~ ' ' ~ classStartTime|time() %} {% set thisWeeksDay = page.startDate|date_modify('...


1

Turns out there's a plugin for that. Typography, by nystudio107. https://nystudio107.com/docs/typogrify/#using-typogrify


1

How about this? {% set uniqueLocations = craft.entries.section('locations').relatedTo(mockExams).all() %} {% for location in uniqueLocations %} {{ location.title }}<br /> {{ location.address }} {% endfor %}


1

That's not the answer to this question, but it's kinda related... Sometimes its worth to consider using {% do %} statement instead of using a custom tag. No need to handle Twig tokens and other complicated matters related to the custom tag. https://twig.symfony.com/doc/2.x/tags/do.html {% do %} can use any variable defined by plugin/module - it just doesn't ...


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