Skip to main content

New in Craft CMS 5.7

Craft 5.7 came out earlier this week. The headline is copy-and-paste for nested elements, which is worth pausing on: it's the first thing that only works because of a decision made thirteen months ago.

Copy and paste for nested elements

I updated a client to 5.7 a day after it came out and walked their editors through it. They run a content builder that powers their entire site, with every section and page type built from Matrix blocks. Until now, reusing a block somewhere else meant rebuilding it by hand.

5.7 adds a Copy action to element indexes, nested element cards, and inline-editable Matrix blocks, for entries and addresses. Copy a block in one Matrix field, then paste it into another. Different field, different entry, different section.

When you copy, a notification appears and follows you around the control panel, keeping track of what's on the clipboard. A paste button turns up wherever the content can go. It clears itself after pasting, so there's no history as there is with a system clipboard, but for moving blocks around, it does what you'd want.

Here's the part that interests me. In Craft 4, this wasn't a missing feature; it was an impossible one. A Matrix block belonged to its field. It was its own element type, with its own tables, and there was no meaningful sense in which a block from one field was the same kind of thing as a block from another. Craft 5 made blocks entries, and an entry is an entry regardless of which field it's sitting in.

When I wrote about Craft 5 last March, I said the thing I'd keep noticing was that the distinction between a block and an entry had disappeared. Until now it was architecture. This is the first time it's a feature.

Duplicate

Nested element cards and inline-editable Matrix blocks also get a Duplicate action, which drops a clone next to the original. Copy is for elsewhere, Duplicate is for here.

Worth knowing if you build on it: the `elements/duplicate` action no longer creates an unpublished draft by default, and no longer deletes the source element when it's a provisional draft. Both behaviors are still available via params.

Editability conditions

Custom fields can now have editability conditions in their field layout settings, making a field read-only rather than hidden depending on who's looking.

I set this up for the same client. Their technical specification tables need to stay visible to everyone, because editors reference the values while writing everything else, but only one group is allowed to change them. Hiding the field would have meant the people who read it most couldn't see it at all.

The difference from visibility conditions matters more than it sounds. A hidden field looks like a field that doesn't exist, and the editor who needs it eventually asks where it went. A read-only field with a badge tells them it exists, it's just not theirs. That's a much easier conversation than the one where somebody is convinced you removed something.

Button Group fields

A new field type that behaves like radio buttons and displays as a row of buttons. Text alignment is the obvious case: left, center, right as three buttons rather than three radio options in a list. Icons can be set per button.

Icons and colors for select fields

Checkboxes, Dropdown, Multi-select, and Radio Buttons fields can now have an icon and a color per option.

Same idea as the entry type icons from Craft 5, applied a level down. A theme selector with Light, Dark, and Accent reads faster with a sun, a moon, and the colors themselves than it does as three words in a list.

JSON fields

A new field type for storing raw JSON on an element. Most editors will never see one. It's for cases where structured data arrives from elsewhere and has to live in Craft, and you'd rather not model it as fields.

The Link field, still going

In January I wrote that the Link field was finally complete after four releases. Complete, it turns out, meant complete for what I happened to need.

It gets a "Download" advanced field in 5.7, plus an SMS link type, an "Allow custom URL schemes" setting, and settings for showing unpermitted sections and entries. GraphQL data gains `download`, `filename`, `defaultLabel`, and nested element fields.

Slideouts caught up

Element editor slideouts now show other authors currently editing the same element.

The activity indicators arrived in 4.5, back when the whole release was about people working on the same content at once. They only ever worked on full edit pages. Anyone editing through a slideout, which since Craft 5 is a lot of the editing that happens, saw nothing.

Further down

Chips, cards, and inline-editable Matrix blocks have been redesigned for consistency. Edit buttons now sit in cards' titlebars instead of being hidden in the action menu, and nested entry cards no longer link to their edit page.

Matrix fields get an "Enable versioning for entries in this field" setting. Sections' Max Authors can be left blank for unlimited, or set to 0 to hide the Author field entirely. There's a new `db/repair` command, a `fields/delete` command, and a` --batch-size` option for resave.

And a batch of handles are no longer globally reserved: `content`, `value`, `rawContent`, `classHandle`, plus `section`, `type`, `postDate`, and `username` outside of the layouts where they'd actually collide. If you've ever renamed a field because Craft wouldn't let you call it content, that's over.

Another nine accessibility entries, including skip links for the main section and both sidebars, and a proper heading structure in field layout designers.

Conclusion

Copy and paste is the feature people will use. What makes it interesting is that it isn't really a feature: it's an architectural decision from March 2024 finally showing up where editors can see it.

Check the full changelog for everything not covered here.

Thomas Sausen

Web Developer

Self-employed web developer from Germany who started with WordPress websites in 2005, then moved to ExpressionEngine and lost his heart to Craft CMS in 2013. As the founder of Craftentries, he has been covering the Craft ecosystem since 2015.
  • Craft 510
    Craft 5.10 came out yesterday. The headline is a deletion workflow that stops you before you break something, and it turns out Craft has had one of these for years without anyone noticing.
  • Craft 59
    Craft 5.9 came out yesterday. Two or three of the additions will change how I set up the control panel on new projects.