Refactore for Contao 3.1 or newer.