Contao news

Read the official Contao announcements.

Contao 4.13.0 is available

by Leo Feyer – Announcements

Contao version 4.13.0 is available. The release includes new features like layouts for subpages, front end preview links, canonical URLs, preview images for documents, database backups via command, improved overview of deleted records, a maker bundle and much more.

Page layout inheritance

You can now set a different layout for subpages in the page structure. By default, the selected page layout is inherited by the subpages.

Resources: #3419

Front end preview links

A front end preview link is a link to a specific front end page that you can share with other people. These other people can then access the preview without having their own back end account.

Resources: #3872

Maintenance mode per root page

The maintenance mode in the front end can be activated per root page in the future. The system-wide maintenance mode in Contao 4.13 also includes the back end and can be activated with the Contao Manager or on the command line.

Resources: #3729

Two pages with the same alias

In Contao 4.13, a page alias can be used for multiple pages if they have different parameters.

Example: The page "News" has the alias news and lists all available news. The page "News reader" also has the alias news and additionally the option "Element required" and shows the detail view of a news item.

Resources: #3843

Canonical URLs in the front end

If the rel="canonical" tag is enabled in the root page settings, Contao outputs canonical URLs in the frontend. The canonical URL can be customized per subpage. Contao automatically points to itself canonically and you can set it to keep certain query parameters.

In addition, the search indexer ignores pages with foreign canonical URLs in the future, which improves the search index.

Resources: #3616

Preview images for documents

Preview images, for example in a download element, can now also be created for documents such as PDFs, Word or Excel files. This requires Imagemagick or Graphicsmagick to be installed on the server and PHP to be compiled with the Imagick or Gmagick extension. Depending on the document type further packages like Ghostscript are needed.

Resources: #3848

Template element

The template element or template module allows the simple integration of an individual template without having to "abuse" the HTML element. Optionally, variables can be passed.

Resources: #3625

Root page dependent modules

The new module "Root page dependent modules" allows to include different modules depending on the root page. This is supposed to be an alternative to inserting modules using insert tags like iflng and insert_module.

Resources: #3613

Overview page

If an overview page is selected in a news or event reader, Contao automatically creates a link back to the overview page. The name of the link can be customized.

Resources: #3862

Delete home directory

In the "Close account" module, there is now an option to automatically delete the home directory as well when a member irrevocably deletes their account.

Resources: #3522

Image sizes in RSS feeds

Image sizes can now be used in RSS feeds of news and events.

Resources: #3630

Image dimensions in the upload widget

For file uploads in the form generator, the system-wide image height and width can be individually overridden.

Resources: #3628

Improved undo

The undo module now shows a preview of the deleted element instead of the DB query. This makes it much easier to see which element it is. Also, the parent element can be opened to quickly see to which element the deleted record belongs.

Resources: #3498

Improved UX in the back end

If there are restricted permissions (pagemounts) in the tree view, the parent pages are now displayed as well so that editors can orient themselves better. In addition, items in the navigation path can now be clicked.

In the file manager, folder names can now be entered with a slash to create multiple, nested folders in one go.

Resources: #3391, #3727, #3793

Custom backend URL

The classic /contao, under which the back end is called, can now be changed to e.g. /admin. At this point, we would like to point out that the feature is not to be misunderstood as a security measure. It is rather intended for cases where someone wants to use the /contao path as a regular page in the front end.

Resources: #3472

Parameters for insert tag links

The new parameters ::blank and ::absolute allow to open insert tag links in a new window and to generate absolute URLs.

Resources: #3230

DB backups via command

The commands contao:backup:create, contao:backup:list and contao:backup:restore allow database backups to be created and managed without the need to have the mysqldump binary installed on the server. The tables to be backed up can be restricted in the configuration.

Contao automatically creates a backup when a database migration is triggered. If this is not desired, the --no-backup flag can be set.

Resources: #3631

Maker bundle

Similar to the Symfony Maker bundle, there is now also a Contao Maker bundle that can be used to create the following resources:

  • Content elements
  • DCA callbacks
  • Event listeners
  • Front end modules
  • Hook listeners

Resources: #3615

SendNewsletterEvent

The SendNewsletterEvent has been added as a replacement for the sendNewsletter hook. Unlike the existing hook, the event is executed before a newsletter is sent, so not only can the content of the newsletter be customized, but sending can also be skipped altogether for individual recipients.

Resources: #3489

Constants for DCA flags

Instead of 'mode' => 4 you can now write 'mode' => DataContainer::MODE_PARENT.

Resources: #2892

Insert tag service

The contao.insert_tag.parser service allows parsing insert tags. In addition, the allowed insert tags can be configured in the future.

Resources: #3638, #3603

Service annotations

Service annotations can now also be written as PHP 8 attributes.

#[AsContentElement(category: "texts")]
class CustomElementController extends AbstractContentElementController
{
}

Resources: #3619

DC_Table::toggle()

A toggle() method has been added to the DC_Table to enable or disable selected fields.

Resources: #3889

Logger service

A new logger service allows you to easily write log entries to the system log in the back end without having to create a Contao context. Contao provides several services for this purpose, including:

  • monolog.logger.contao.cron
  • monolog.logger.contao.error
  • monolog.logger.contao.files
  • monolog.logger.contao.general

Resources: #3702

Cache tag service

The new service contao.cache.entity_tags allows to add the necessary cache tags to the response, which are needed for the automatic invalidation of the shared cache.

class MyController
{
    private EntityCacheTags $entityCacheTags;

    public function __construct(EntityCacheTags $entityCacheTags)
    {
        $this->entityCacheTags = $entityCacheTags;
    }

    public function __invoke(): Response
    {
        // ...

        $this->entityCacheTags->tagWithModelInstance($page);

        return $response;
    }
}

Resources: #3180

Custom back end controller

Custom back end controllers can now inherit from the AbstractCustomBackendController class and work directly with the be_main template.

Resources: #3180

Insert tag Twig functions

The new Twig functions insert_tag and insert_tag_raw allow processing insert tags in Twig templates.

{{ '<br> {{br}}'|insert_tag }}
{{ '<br> {{br}}'|insert_tag_raw }}

Resources: #3606

Virtual file system

A virtual file system based on Flysystem has been added as a new, experimental feature. By default, the local file systems contao.filesystem.virtual.backups and contao.filesystem.virtual.files are mounted; additional VFS can be added.

Resources: #3774

And a lot more

An overview of further changes can be found in the changelog.

A special thanks goes to the documentation team and all the helpers who had already documented almost all new features before the release of Contao 4.13.0. You guys rock!

Compatibility

Contao 4.13 is compatible with Symfony 5.4, PHP 7.4+ and Doctrine 3.

Also see: Tickets | Version comparison | Changelog

Show all news

Comments

Add a comment

Please calculate 2 plus 2.