public function initializePanels(ActionEvent $event)
    {
        if (!$this->scopeDeterminator->currentScopeIsBackend()) {
            return;
        }

        if (!\in_array(
            $event->getAction()->getName(),
            ['copy', 'create', 'paste', 'delete', 'move', 'undo', 'edit', 'toggle', 'showAll', 'show']
        )
        ) {
            return;
        }

        $environment = $event->getEnvironment();
        $definition  = $environment->getDataDefinition();
        $view        = $environment->getView();

        if (!$view instanceof BaseView
            || !$view->getPanel()
            || !$definition->hasDefinition(Contao2BackendViewDefinitionInterface::NAME)
        ) {
            return;
        }

        /** @var Contao2BackendViewDefinitionInterface $backendDefinition */
        $backendDefinition = $definition->getDefinition(Contao2BackendViewDefinitionInterface::NAME);
        $listingConfig     = $backendDefinition->getListingConfig();

        $dataConfig = $environment->getBaseConfigRegistry()->getBaseConfig();
        $panel      = $view->getPanel();

        ViewHelpers::initializeSorting($panel, $dataConfig, $listingConfig);
    }