The removeOldFeeds hook is triggered when old XML files are being removed from the Contao root directory. It does not pass an argument and expects an array of file names to preserve as return value.

Return Values

Return an array of XML file names (do not include file extension!) that must not be removed from the root directory. Return an empty array if you have nothing to keep.


// src/EventListener/RemoveOldFeedsListener.php
namespace App\EventListener;

use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;

class RemoveOldFeedsListener
    public function __invoke(): array
        // Return the names of your custom feeds which should not be removed
        return ['custom'];