Contao news

Read the official Contao announcements.

Welcome Contao 5.1

by Marcus Lelle – Current issues

The time has come. The new version 5.1 of Contao is here!

The core team and many other developers spared no effort and spent countless hours to bring our favorite CMS to the next level. There are several new features for users and developers.

Contao 5.1 replaces Contao 5.0, which will no longer be supported. The new version will be supported with updates until August 2023. You can find out which Contao versions are currently supported here.

For users

Backend favorites

In the Contao backend, any links can now be saved as favourites.

The favourites are then collected on the left above the content and can also be nested in levels. They can be edited, reordered and deleted via the star symbol in the orange info area.

In the course of this, a new, third navigation level has also been added in the backend.

Advanced grid view

Until now, fields in the input screens of Contao and its extensions could only take up the full or half width of the available space. From now on, there are also classes for 1/4, 1/3, 2/3 and 3/4 width for the fields. #5672

Dark mode

For those who prefer a higher contrast and/or often work at night, there is now a Dark Mode. #5031

The mode automatically adjusts to your operating system settings, but can of course also be selected manually.

Copy repeatedly

In all list views, after you have selected the function "Edit multiple", you now have the possibility to use "Copy repeatedly". After pasting the copied elements, they remain in the clipboard and can be copied further.

The function is terminated by clicking on "Clear clipboard". #5417

Sort both ways

Fields can now be sorted in ascending and descending order in list views.

There are new flag values for DCA fields:

  • DataContainer::SORT_INITIAL_LETTER_BOTH Sort by initial letter both ways
  • DataContainer::SORT_INITIAL_LETTERS_BOTH Sort by initial X letters both ways
  • DataContainer::SORT_DAY_BOTH Sort by day both ways
  • DataContainer::SORT_MONTH_BOTH Sort by month both ways
  • DataContainer::SORT_YEAR_BOTH Sort by year both ways
  • DataContainer::SORT_BOTH Sort both ways

#5425

Protected articles

You already know it from protected pages. If you make articles accessible only to one or more member groups after a login, this is indicated in the overview by a symbol with a lock. #5304

Advanced element preview

The element preview now reveals more about the content of the respective element. This allows the editorial team to decide more quickly which element needs to be edited in order to adapt certain content of the frontend. #5609

Default search field

Developers can now specify per DCA which field should be searched by default as long as user:inside has not made a selection. #5364

Note on missing admin email address

Immediately after logging in, you will see a message in the dashboard as long as you have not entered an administrator e-mail address in the system settings. #5427

Submit forms via Ajax

Every form in Contao can now be submitted via Ajax. You can set this in the configuration of the form. Then no redirection to a page is necessary, but you can set a message that is displayed on the same page after submission. #5307

URI and page ID in the system log

In the entries of the system log, the URI and, if available, the page ID are now stored for each entry. #3694

For developers

Login-Rate-Limit

The login rate limit now applies equally to existing and non-existing users. This gives attackers one less way to find out which usernames exist and which do not.

Contao now also displays an "Login failed" if a wrong password is entered for non-existing users. #5368

Background-Worker

Background workers make it possible to execute long-lived processes such as sending mails or indexing pages asynchronously in the background. #5405

Accordingly, they open up completely new possibilities for extension developers and we are looking forward to seeing what the community will do with them!

New feed reader module

The new feed reader module reads not only RSS and Atom feeds but also JSON feeds. #4847

The old feed reader module remains for backwards compatibility reasons. So there are now two frontend modules to choose from in the backend, one of which has been marked as "deprecated".

Asynchronous cron jobs

Cron jobs can now be executed asynchronously. This means that, for example, every minute cron job no longer has to be processed sequentially, but it is also possible to start several jobs at the same time thanks to Promises.

The new ProcessUtil class also facilitates the creation of asynchronous cronjobs that serve a Symfony process. #5554

Deactivate web cron jobs automatically

Another improvement in connection with cron jobs is the new, automatic recognition of whether a real cronjob is available via CLI or not. Previously, the "poor man's cron" had to be manually deactivated in the config (localconfig.disableCron), but this is no longer necessary. Contao now has an auto setting that is active by default. This way, Contao automatically detects when a real, minute-by-minute cronjob is running via contao:cron and deactivates the web cronjob accordingly. #5591

Error handling in forms

The form generator is now able to display general error messages in the form. This means that they no longer have to refer to a specific form field. This option is available to developers in the form generator hooks. #4898

MemberActivationMailEvent

A new MemberActivationMailEvent is available. It allows the activation email to be provided with additional simple tokens, as our newsletter bundle has always done for ##channels, for example. Thanks to this new event, this possibility is now available to all developers. #5116

attributes_callback

Sometimes it is quite helpful in the backend if you could make certain DCA definitions, such as eval statements, dynamic. It would be conceivable to have a field that is either mandatory or not, depending on another field. Until now, this had to be realised with an onload_callback, for example, which has the disadvantage of not having the current record available. Therefore, a dedicated attributes_callback is now available, with which one can conveniently influence the widget attributes. #5673

Locale in Template::trans()

Thanks to various changes in Symfony and our substructure, it is now also possible to pass a locale within templates for the trans() helper.

Accordingly, this is now possible:

en: <?= $this->trans('ERR.general') ?>
de: <?= $this->trans('ERR.general', [], 'contao_default', 'de') ?>
cs: <?= $this->trans('ERR.general', [], 'contao_default', 'cs') ?>

#5371

At the end

Thank you for reading this far. Finally, one more request:

There are many ways to support Contao. Every support is important. Only in this way can Contao be developed further in the long term. Even the numerous extensions cannot be taken for granted. Everyone is happy about small tokens of appreciation and new orders. In the end, we all benefit from it.

You already support Contao? Then I would like to take this opportunity to thank you.

I am looking forward to inspiring comments, feel free to make suggestions for Contao 5.2.

And now to something not completely different: Christian from the Contao Academy has made a fantastic video about the new features of Contao 5.1.

Show all news

Comments

Add a comment

Please add 8 and 6.