reviseTable
The reviseTable hook is triggered when Contao removes orphan records from a
table. It passes the name of the current table, the IDs of all new records, the
name of the parent table and the names of all child tables as arguments and
does expect a boolean as return value (returning true will cause the current
page to be reloaded).
Info
This hook can also be implemented as an anonymous function.
Parameters
string
$tableThe current table name.
array
$newRecordsArray containing the ID of the new records. Can be
null.string
$parentTableOptional parent table of the current table. Can be
null.array
$childTablesOptional array containing the names of the child tables. Can be
null.
Return Values
Return true if the current page should be reloaded. Otherwise return false or null.
Example
// src/EventListener/ReviseTableListener.php
namespace App\EventListener;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
#[AsHook('reviseTable')]
class ReviseTableListener
{
public function __invoke(string $table, array|null $newRecords, string|null $parentTable, array|null $childTables): bool|null
{
// Do something …
}
}