Contao news

Read the official Contao announcements.

Contao 4.8.0 is available

by Leo Feyer – Announcements

Contao version 4.8.0 is available. The release contains new features such as deferred image resizing, 2-factor authentication in the front end, splash screens for YouTube and Vimeo videos, service tagging with annotations and a lot more.

You can find more information on many of the following features in Yanick's recap of the developer's meeting.

Deferred image resizing #354

In Contao 4.8, creating thumbnails happens deferred and no longer within the page rendering process. This does not only make the page load a lot faster, it also allows to generate only those images that have actually been requested. So out of a source set with different resolutions (e.g. 1x, 1.5x, 2x), only the images matching the device will be generated.

Therefore, it can no longer happen that a user accidentally clicks the "Toggle all" link in the file manager bringing the back end to a halt, because there is too little RAM or script runtime to generate all the thumbnails.

Deferred image resizing is not to be mistaken with lazy image loading, which only loads the images from the server once they are scrolled into the view of the visitor. We will implement lazy image loading as soon as the browsers natively support it (see #433).

2-factor authentication in the front end #363

Since Contao 4.6, back end users have been able to secure their accounts with 2-factor authentication. The same functionality is now also available for front end users. The administrator can decide per website root page whether 2-factor authentication is optional or mandatory for everyone.

HTTP cache

Unnecessary cookies, which prevent storing a page in the shared cache, have been the last big hurdle to effectively using the HTTP cache. We have solved this problem – at least for the core distribution – in Contao 4.8. You can guess how much work this was from the number of related tickets: #351, #365, #389, #467, #468, #471, #482, #483, #515, #551, #553, #565 and #594.

For the first time, Contao is now entirely compatible with reverse proxies such as Varnish. The chart below shows the time that Contao 4.7 and 4.8 with and without cache take to render a page:

The absolute numbers are irrelevant, because they depend on many technical factors such as the server workload. In the relative comparison, however, you can say that Contao 4.8 with cache renders pages about 40% faster than Contao 4.7 with cache!

Improved debug mode #544

You can enable the debug mode in Contao 4.8 with a simple mouse click in the back end, without having to use an app_dev.php file for which you have to set a password first. Furthermore, the debug bar now also shows the Contao translations in the "Translation" section.

Improved image processing #529 #552

In Contao 4.8, uploaded images will be rotated automatically by their EXIF data. Contao can also create optimized WEBP versions of the images and automatically add them to a picture element if requested. Modern browsers then only load the optimized image.

In the course of these changes, the "Default image sizes" field has been moved from the theme settings into the page layout settings.

Splash image for YouTube/Vimeo videos #300

To prevent sending data to the provider by embedding a YouTube or Vimeo video, you can use a splash image in Contao 4.8. The video is then only loaded after the visitor has clicked the splash image.

There is a live example of this feature in the "Deferred image resizing" section of this news article.

Number range of numeric text fields #437

The form generator contains two new input fields "minimum value" and "maximum value", which you can use to define the number range a visitor can enter into a numeric text field.

Minimum keyword length #274

The search module can be configured to ignore keywords that deceed a certain minimum length when searching in Contao 4.8.

Show featured news first #371

The "news list" module now includes an option to show featured news items before the regular ones.

Contao components #332

In Contao 4.8, several Contao components have been removed, because they were either outdated or they provided a function that the browsers now implement natively.

Symfony 4 folder structure #566

In Symfony 4, the config files are stored in the /config folder instead of in the /app/config folder. Even though Contao 4.8 continues to support the old locations, using the /app folder has been deprecated and is no longer recommended.

  • Custom Symfony config files (e.g. config.yml or services.yml) should be stored in the /config folder and no longer in the /app/config folder.
  • Custom Contao files (e.g. DCA files, translations or templates) should be stored in the /contao folder and no longer in the /app/Resources/contao or /src/Resources/contao folders.

Service tagging with annotations #540

Alternativ to tagging a service as hook, callback or fragment in the services.yml file, it can be tagged with annotations in Contao 4.8.

use Contao\CoreBundle\ServiceAnnotation\Hook;
use Terminal42\ServiceAnnotationBundle\ServiceAnnotationInterface;

class MyListener implements ServiceAnnotationInterface
     * @Hook("getPageLayout")
    public function onGetPageLayout()

     * @Hook("loadPageDetails", priority=32)
    public function onLoadPageDetails()

You can find the bundle documentation here: terminal42/service-annotation-bundle

Custom picker insert tags #450

In Contao 4.8, you can overwrite the default picker insert tags and e.g. use a different tag depending on the context.

// Adds the |absolute flag to the link_url tag
'eval' => [
    'dcaPicker' => [
        'insertTag' => '{{link_url::%s|absolute}}',

// Uses either the link_url or news_url tag depending on the context
'eval' => [
    'dcaPicker' => [
        'pagePicker' => [
            'insertTag' => '{{link_url::%s}}',
        'newsPicker' => [
            'insertTag' => '{{news_url::%s}}',

Predefined image sizes #537

Image sizes can now also be defined in a configuration file, in case you want to versionize and reuse them.

        width: 100
        height: 200
        resizeMode: 'box'
        zoom: 100
        cssClass: 'foobar-image'
        densities: '1x, 2x'
        sizes: '100vw'
          - width: 50
            height: 50
            resizeMode: 'box'
            zoom: 100
            cssClass: 'foobar-image'
            densities: '0.5x, 2x'
            sizes: '50vw'
            media: '(max-width: 900px)'
          - width: 25
            height: 25
            resizeMode: 'box'
            zoom: 100
            densities: '0.5x, 2x'
            sizes: '25vw'
            media: '(max-width: 450px)'

Generic DCA labels #532

In Contao 4.8, it is no longer necessary to add a label to every DCA action and every DCA field. Contao will find the labels by their keys and automatically fall back to generic action labels if the respective language file does not define them.

Thus you could delete the commented lines in the following example:

'list' => [
    'operations' => [
        'edit' => [
//          'label'     => &$GLOBALS['TL_LANG']['table']['edit'],
            'href'      => 'act=edit',
            'icon'      => 'edit.svg'
'fields' => [
    'title' => [
//      'label'         => &$GLOBALS['TL_LANG']['table']['title'],
        'exclude'       => true,
        'inputType'     => 'text',
        'eval'          => array('mandatory'=>true 'tl_class'=>'w50'),
        'sql'           => "varchar(255) NOT NULL default ''"

And a lot more

An overview of the other changes is available in the changelog.

Update notes

Martin has released version 1.0 of his image library contao/image. There have been a couple of API changes which you should check out if you work with the library.

Furthermore, the mobile page layout is no longer part of the core distribution as of Contao 4.8. If you need the functionality, please install the contao/mobile-page-layout-bundle package; either in the Contao Manager or on the command line (composer require contao/mobile-page-layout-bundle). Please note that you cannot use the HTTP cache if you work with mobile page layouts!

Symfony compatibility

Contao 4.8 is compatible with the following Symfony versions: 4.2, 4.3

Also see: Tickets | Version comparison | Changelog

Show all news


Add a comment

Please add 9 and 4.