New in Craft CMS 5.4
Craft 5.4 came out today. No headline feature, and a good part of it answers things from the last two releases.
The Link field, one month on
In August I wrote that the new Link field was a good start and unfinished: no label input, no target setting, no class setting.
5.4 adds settings. Just not those. Link fields now have "Allow root-relative URLs" and "Allow anchors," and Link fields no longer reject URLs with TLDs longer than six characters, which is the kind of thing that surfaces the moment someone tries to link to a `.digital` or `.consulting` domain. URLs with TLDs longer than six characters, which is the kind of thing that surfaces the moment someone tries to link to a `.digital` or `.consulting` domain.
So the field is being visibly worked on four weeks after release. What it's getting first is validation control, not presentation control. That's arguably the right order, and it still means a button label is a second field next to the first.
Field layout tips and warnings
Field layouts can now define tips and warnings shown alongside fields.
This is the addition I'll use most, and it's not close. Every project I hand over ends with a round of questions, all the same: what goes in this field, and how long can it be? Field instructions cover part of that, but instructions are for what the field is. A warning is for what happens if you get it wrong. Until now that went in the instructions too, where it carried the same weight as everything else and was read with the same attention, which is to say none.
The real test is whether it survives contact with editors who have stopped reading. But at minimum it moves documentation from a handover document nobody opens into the screen where the work happens.
Inline editing in the Entries index
Post dates, expiry dates, slugs, and authors are now editable directly from the Entries index. Category slugs got the same on the Categories index.
Single sections with multiple entry types
A single can now have multiple entry types. Previously, that meant either a workaround or a second section, and the workaround was usually worse than the problem.
"Used by" columns
The Fields index shows how many field layouts each field is used by. The Entry Types index lists which sections and custom fields each entry type belongs to.
This is a smaller version of the same idea as the tips: making structure visible from where you're standing. It also cleans up after Craft 5. Field instances let the same field appear repeatedly under different names, which was the point, but it also meant a field could turn up in places you'd forgotten about. In the same vein, field selectors in field layouts now show a pencil icon when a name, instructions, or handle has been overridden, plus a chip for the underlying global field. Both answer the same question: what am I actually looking at?
Not related to
Element conditions get a "Not Related To" rule, and queries get `notRelatedTo` and `andNotRelatedTo` parameters, plus the GraphQL argument. The counterpart to relatedTo, which is more useful than it sounds: articles not already linked from this entry, products not yet featured, anything defined by absence.
Preview URLs get locked down
Preview parameters are now hashed and validated, unverified parameters no longer end up in generated URLs, and preview requests send X-Robots-Tag: none.
The first two close off a way of forcing preview mode on a request. The third is the one with everyday consequences: preview URLs were indexable, which means unpublished content could turn up in search results. I haven't been bitten by this, but I've heard of enough people who were, and it's the sort of thing you only discover when a client asks why a draft is on Google.
One consequence of Craft 5
Hard-deleting an element now also hard-deletes its nested elements.
That's the architecture from March showing its edges. Once Matrix blocks are entries, deleting the parent leaves children behind unless something goes looking for them. Not a headline, but if you've been hard-deleting entries since March, there's more in your database than you think.
Conclusion
Most of 5.4 is Pixel & Tonic cleaning up after themselves, in the good sense: the Link field getting settings, field instances becoming legible, nested entries deleting properly.
The tips and warnings are the exception, and the one thing here I'll put into a project this week.