IntroductionIntroduction

Craft tips, plugins, stars and Berlin.

We're still a couple months away from the official Craft 3 release date, but the Github Craft repo is already over 1000 stars. Plus we've got a bit of news regarding the next Dot All, coming in September.

The tide seems to be turning here in link-land to favor Craft 3 content as well. Most of the news, tips and plugins have a Craft 3 focus to them. There are still Craft 2 goodies in here, but, thankfully, there is no mention of Craft 4. (Just keep swimming, my friend, we'll get there.)

Thanks to fortrabbit for sponsoring this issue!

Let's hit the links.

-John Morton

Craft Link List  

Top Stories


News


Featured Sponsor

Tools, tips and fundamentals







When Twig expects a string but you have a variable.

Imagine you are trying to merge a bunch of items into an array and tomorrowDate is a variable, not text. The following Twig would fail.

{% set groupedEventItems = groupedEventItems|merge({ tomorrowDate: eventItem }) %}

How do you get tomorrowDate to be read as a variable and not just text? Use parentheses to make Twig recognize tomorrowDate as a variable, like this:

{% set groupedEventItems = groupedEventItems|merge({ (tomorrowDate): eventItem }) %}

And Jake Dohm also mentioned this "works in other contexts, not just merge, where Twig expects a string and you have a variable."

Craft Link List  

Perfecting your technique


Sponsor

Plugged In












The Craft Advantage


Overheard

It’s not Craft, but it’s interesting.