#Announcements

Craft 4

Craft 4

The first stable release of Craft 4 has arrived!

Craft 4 brings improvements across the board, with an emphasis on author experience, user management, and assets. Here’s the highlights:

Author Experience

Performance. Draft and revision creation are now substantially faster, especially for multi-site installs and complex content models with Matrix, Neo, and Super Table blocks nested within each other.

Accessibility. We’ve drastically improved authoring accessibility, particularly for people using assistive technologies like screen readers.

Element index filtering. Element indexes can now be filtered to only show certain elements based on a variety of built-in element condition rules, such as Entry Type and Author.

Entry filters in Craft 4

Custom element sources. Site admins can now easily create custom element index sources available to all authors, which are configured to only show certain elements based on preset condition rules. Native element sources can also be disabled.

Conditional fields. Field layout elements and tabs can now be configured to only be visible/editable when certain conditions are met, based on the element being edited, as well as the logged-in user.

Conditional field in Craft 4

Relation conditions. Relational fields such as Entries, Assets, and Users fields now have settings that further limit which elements should be relatable, beyond the Source setting.

New element editor slideouts. Element editor slideouts now support provisional drafts and autosaving, just like Edit Entry pages.

Element index state linking. Element index pages now keep their URL updated with the selected status and sort options, making it easy to share the URL with a teammate without losing track of the view state.

Element auto-refreshing. When an element is updated, other open browser tabs are now notified, so they can automatically refresh any references to the same element.

Category drafts. Categories now have the same drafts support as entries.

User Management

Addresses. Users can now manage addresses, which can be referenced by plugins such as Craft Commerce.

Full names. Users now have a single “Full Name” field, rather than “First Name” and “Last Name” separately. Their first and last names are now parsed from their full names, and are still available for sorting purposes.

Inactive users. It’s now possible to manage users that represent a person or entity, but don’t actually have login credentials.

Expanded formatting locale support. Users can now set their Formatting Locale to any known locale; not just the ones the control panel has been translated for.

Assets

Filesystems. Volumes no longer have types or handle file operations directly; they are now assigned a “filesystem” which handles the file operations. And volumes can be assigned to different filesystems per environment.

Transform filesystems. Volumes can now be assigned a separate filesystem specifically for storing image transforms. So it’s possible to have a volume configured to use a non-public filesystem for asset storage, while using a public filesystem for image transforms.

Easier focal point adjustments. It’s now possible to edit images’ focal points from their preview modals, in addition to within the Image Editor.

Adjusting a focal point in Craft 4

Restrict with subfolders. Assets fields can now be restricted to a single location, including any of its subfolders.

Alternative text. Volume field layouts can now include a native “Alternative Text” field, which is used to define alt attributes on system-generated <img> tags, via Asset::getImg() and images rendered within the control panel.

Development

There’s a few exciting development improvements as well:

PHP 8. Craft now requires PHP 8, enabling developers to safely take advantage of several new language features.

Conditions. The same condition framework used by element index filters and field conditions can be extended for a variety of new use cases.

Money fields. Craft now includes a built-in “Money” field type, as well as a new |money Twig filter.

Control panel screens. Controllers can now provide the HTML for screens in the control panel, which can be rendered as both full pages and slideouts.

Volume and filesystem edit screens in Craft 4

Unified element editor. Custom element types can take advantage of a new, centralized element editing experience, with zero boilerplate code needed.

Better environment support. Most of Craft’s general config settings and database connection settings can now be overridden with environment variables, like CRAFT_DEV_MODE and CRAFT_DB_USER. Additionally, it’s now possible to set site statuses with environment variables.

External resource caching. {% cache %} tags will now keep track of any external JavaScript and CSS resources that were registered within the cached content, and re-register them on subsequent page loads.

Image transformers. It’s now possible to register custom image transformers, which can override the built-in GD/ImageMagick-based transformer.

Proxy queues. The queue component can now be configured to use an external queue service while still taking advantage of Craft’s Queue utility, by adding the external queue as a proxy of Craft’s native one.

Laravel Collections. Laravel Collections are now built into Craft, providing new ways to simplify Twig and PHP code.

Symfony Mailer. Craft now sends emails using Symfony Mailer rather than Swift Mailer.

Monolog. Craft now supports PSR-3 logging with Monolog.


You can read the full release notes in the changelog.

Ready to upgrade?

If you’re upgrading an existing Craft 3 site, you can start by updating to 3.7.40, which adds a Craft 4 Upgrade utility that provides an overview of your plugins’ readiness.

The Craft 4 Upgrade utility, shown in Craft 3

Each of our demo sites have been updated for Craft 4, so you can quickly take them for a spin.

When you’re ready to dive in, read through the Craft 4 upgrade guide for step-by-step instructions on performing the upgrade.

Thanks!

The Craft community has been working tirelessly throughout the Craft 4 Beta period, making sure plugins are ready to go, and helping us test out the changes. We can’t overstate how helpful everyone has been, and for that, we owe the community a huge thank you! It’s thanks to all of you that Craft 4 is ready to ship on schedule.

May Craft the Fourth be with you!

Prev
Craft’s Accessibility Conformance Report
Blog Home
Next
Commerce 4