src/Contao/Event/Subscriber.php
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);
    }
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);
    }
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 ) ; }
Initialize the panels for known actions so that they always know their state.

@param ActionEvent $event The event.

@return void
Initialize the panels for known actions so that they always know their state .