The method AdminImportExtension::configureActionButtons does not check if the current $admin implements the AdminWithImport interface and alwasy adds the import action. This breaks admins for which an import does not exist with an exception similar to
An exception has been thrown during the rendering of a template ("unable to find the route admin.company.import").
Proposed resolution is to check if $admin implements the import interface as follows:
public function configureActionButtons(AdminInterface $admin, $list, $action, $object): array
{
if (!$admin instanceof AdminWithImport) {
return $list;
}
$list['import']['template'] = $this->templates['action_button'];
return $list;
}
The method
AdminImportExtension::configureActionButtons
does not check if the current$admin
implements theAdminWithImport
interface and alwasy adds the import action. This breaks admins for which an import does not exist with an exception similar toProposed resolution is to check if
$admin
implements the import interface as follows: