Contao news
Read the official Contao announcements.
Contao 4.9.0 is available
by Leo Feyer – Announcements
Contao version 4.9.0 is available. The release contains new features such as a crawler, a SERP widget, dynamic favicon.ico and robots.txt files, image lazy loading, backup codes and trusted devices for the 2-factor authentication, access control for content elements and form fields, a new front end preview, a universal table picker and a lot more.
Crawler
The crawler allows to rebuild the search index and to find broken links. You can run it either in the back end or on the command line.
SERP widget
The SERP widget tries to display the metadata of a page (title, description, URL) similar to how it will be rendered in the Google search results. The actual display by Google might differ, because Google's search algorithm is complex and individual – e.g. Google might show text from the page instead of its description.
The widget will also work if an editor does not have access to all metadata fields and it can be deactivated completely by not granting access to the field in the user group settings.
Resources: #1092, #1169, #1323
Dynamic favicon.ico and robots.txt files
In Contao 4.9, you can manage favicon.ico and robots.txt files in the site structure. You can change the settings per domain in the root pages which are defined as language fallback.
To make the feature work, you have to delete an existing favicon.ico and/or robots.txt file after the update!
Resources: #717
Image lazy loading
Image lazy loading can be enabled in the image sizes and it will make Contao add the loading="lazy"
attribute in the HTML markup. Browsers supporting the attribute (currently Chrome as of version 76 and Firefox as of version 75) will then decided based on individual logic whether an image is loaded right away or only after it has been scrolled into the visitor's viewport.
Resources: #703
Front end preview
The new preview bar is no longer part of a frameset but injected directly into the HTML markup of the page. Thus both the title and the URL of the page are directly visible in the browser and do not have to be shown in the preview bar anymore. In addition, the "reload" button is no longer necessary, because the site can be reloaded via F5 now.
Resources: #989
Backup codes and trusted devices
The 2-factor authentication has been enhanced by backup codes and trusted devices. You can use backup codes instead of the 2FA token to log in, in case you do not have access to your 2FA device or the 2FA token no longer works. A trusted device is a device on which you do not have to enter a 2FA token even though 2-factor authentication is active.
A trusted device needs to be reconfirmed periodically (approximately every 60 days) by entering a 2FA token.
Access control for content elements and form fields
In Contao 4.9, you can define in the user or user group settings which content elements and form fields your editors are allowed to use. Previously, this function has been provided by the "ce_access" extension, which is now integrated into the core.
Resources: #705
Universal table picker
Article and content element aliases can now be selected with a new table picker instead of in a giant, confusing drop-down menu. This also abolishes the known limitation that content elements from e.g. a news article can only be aliased in another news article.
Resources: #714
Range slider
The new form field "range slider" allows you to add a slider to select a value or range of values between a specified minimum and maximum.
Resources: #521
Migrations
Contao 4.9 contains a new migrations framework which will replace the concept of runonce.php
files in the medium term. Migrations can be executed either in the install tool or on the command line using the contao:migrate
command. Thus, depending on your workflow, you can now update your Contao installation without opening the install tool.
Resources: #709
Cron service
The cron service allows you to tag cronjobs in the DI container and execute them either in the web or CLI context.
namespace App\Cron;
use Contao\CoreBundle\ServiceAnnotation\Cron;
use Terminal42\ServiceAnnotationBundle\ServiceAnnotationInterface;
class MyCron implements ServiceAnnotationInterface
{
/**
* @CronJob("minutely", priority=-1)
*/
public function onMinutely(): void
{
}
/**
* @CronJob("hourly", priority=32, cli_only=true)
*/
public function onHourly(): void
{
}
}
Resources: #1098, Documentation
Back end navigation
Both the top navigation and the main navigation in the back end now use the KnpMenuBundle, which you can modify as desired through custom event listeners.
Service autoloading
To reduce the boilerplate code to register services in the container, services in the src/
folder are registered automatically in Contao 4.9. This also includes the services.yml
file, which had to be loaded manually in the past.
Resources: #1165
.yml and .yaml
As of Contao 4.9, we support both .yml
and .yaml
as extension for YAML files. The official file extension is .yaml
.
@internal
Following the Contao BC promise, we only make incompatible API changes in new major versions. However, some classes are exempt from this BC promise and in Contao 4.9, we have marked these as @internal
so your IDE tells you as soon as you are using one of them.
Environment variables
Contao 4.9 supports environment variables, which are the default in Symfony 4. Alternatively to in your parameters.yml
file, you can store the application settings in the server configuration or in a .env
or .env.local.php
file.
And a lot more
An overview of the other changes is available in the changelog.
Symfony compatibility
Contao 4.9 LTS is compatible with Symfony 4.4 LTS.
Also see: Tickets | Version comparison | Changelog
Comments
Add a comment