Contao news

Read the official Contao announcements.

Contao 5.0 is here!

by Marcus Lelle – Current issues

The time has come: A new major version of Contao is here! A good seven years after the big step to Contao 4, Contao continues on its way with the new version 5.0.

If you don't know exactly how Contao versions are numbered, you can read about it here.

There are always roughly two camps when it comes to such a step. People who can't get new features fast enough, and people who are slow to adopt new features and would rather have everything "the way it used to be". I will address both sides in this news.

The starting point: Contao 4.13

In each new version of the 4 series (from 4.1 to 4.13), great new features have been added to our favorite CMS. Because the core team makes sure that the features in each new version remain compatible with all versions since 4.0, new "backwards compatibility layers" accumulate with each release. Layers of code that keep the old interfaces compatible with the new interfaces so that the old code continues to work.

These "BC layers" make the Contao ship heavier.

To make the ship ready for a lot of new cargo (= features), the core team and all other volunteers have done an unprecedented amount of work and removed a lot of stuff that was marked as deprecated in Contao 4 from Contao 5.0.

More than 3,500 modified files and almost 400,000 modified lines of code speak for themselves. Contao was freed from about 70,000 lines of legacy code.

New for users

Although the focus was on the cleanup, there are also new features and improvements in Contao 5. Here are some of them:

Unified child element handling

Old Contao users will surely stumble at first, but in places where it was not the case before, the pencil now leads to editing the element and no longer one level deeper. For this, a new icon "child elements" has been introduced. An example is the article element.

Pages and files move under "Content"

The links to the page structure and file management can be found in the "Content" menu group in Contao 5.

No more saving of faulty forms

If Contao 5 detects an error when submitting a form in the back end, e.g. that not all mandatory fields have been filled in, the data is not saved. Not even partially, as was the case in Contao 4.

Unsaved elements

New elements that have not yet been saved will be visible in the back end in the future and will be grayed out.

New element "Unfiltered HTML".

This element allows to quickly insert elements like script tags or e.g. inline SVG code without enabling these elements in the security settings. But please remember: Be careful when inserting things you don't understand! This could allow attackers to steal your identity or take control of the entire system. And that's also what it says right below the element.

Content elements are now based on Twig templates

All content elements have been rewritten and are now based on Twig templates. We will go into more detail about the new possibilities with Twig templates in a future news post. There is already a separate chapter in the manual about this.

The Contao install tool has been removed

Most functions can be found in the Contao Manager (see below). SQL dumps of themes can now be imported directly in the back end.

Adjustments to the Contao Manager

As mentioned above, the old Contao install tool is no longer available. Selecting a database during the installation has been moved to the Contao Manager. You can also create an admin there as usual.

Do I have to use Contao 5.0 already?

No! The current Contao LTS version 4.13 was released in February 2022 and will be updated until February 2025. But you don't have to be afraid that everything will be different in Contao 5. The changes are logical and will make it even easier for new users.

News for developers

  • Contao 5 uses the security component of Symfony 6. Extensions that alter authentication probably need to be adapted.
  • Security voters for DCA operations have been added, which in the long run will replace the existing checkPermission() callbacks. The previous system still works in Contao 5, but it does not hurt to familiarize yourself with the new system early on.
  • Models now return real PHP types such as integer or boolean if the database field is is defined accordingly.
  • Country codes are now in upper case.

Deprecations were built into Contao 4.13 for all changes, so if an extension no longer triggers deprecations under Contao 4.13, it should run under Contao 5.

Basically, all developers can search their extensions for used BC layers. The most important information can be found in the DEPRECATED.md file in the respective development branch and is also displayed in the Symfony profiler listed under "Logs" in the "Deprecations" tab.

The adjustments necessary for Contao 5 are documented in the UPGRADE.md file, which is in the development branch of Contao 5.

In addition, it is certainly not wrong to follow the developments in the monorepo.

What else is important

In any case, I recommend Yanick's report from the developers meeting in February 2022.

Please remember that there are many options to support Contao. Any support is important. This is the only way Contao can be further developed in the long term. The numerous extensions are also not to be taken for granted. Everyone is happy about small gifts and new jobs.

Many thanks to all core developers. I would like to thank Leo, Yanick, Andy, Franko and Christian for their support in writing this news.

Contao rocks!

Marcus

Show all news

Comments

Add a comment

Please calculate 4 plus 2.