protected function initializeAction()
    {
        parent::initializeAction();
        $this->solrConnectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
        $this->moduleDataStorageService = GeneralUtility::makeInstance(ModuleDataStorageService::class);

        $this->selectedPageUID = (int)GeneralUtility::_GP('id');
        if ($this->request->hasArgument('id')) {
            $this->selectedPageUID = (int)$this->request->getArgument('id');
        }

        $this->requestedPageUID = $this->selectedPageUID;

        /* @var SiteRepository $siteRepository */
        $siteRepository = GeneralUtility::makeInstance(SiteRepository::class);

        // Autoselect the only one available site
        if (count($siteRepository->getAvailableSites()) == 1) {
            $this->selectedSite = $siteRepository->getFirstAvailableSite();
            $this->selectedPageUID = $this->selectedSite->getRootPageId();
            return;
        }

        if ($this->selectedPageUID < 1) {
            return;
        }

        try {
            $this->selectedSite = $siteRepository->getSiteByPageId($this->selectedPageUID);
        } catch (\InvalidArgumentException $exception) {
            return;
        }
    }
protected function initializeAction()
    {
        parent::initializeAction();
        $this->solrConnectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
        $this->moduleDataStorageService = GeneralUtility::makeInstance(ModuleDataStorageService::class);

        $this->selectedPageUID = (int)GeneralUtility::_GP('id');
        if ($this->request->hasArgument('id')) {
            $this->selectedPageUID = (int)$this->request->getArgument('id');
        }

        $this->requestedPageUID = $this->selectedPageUID;

        /* @var SiteRepository $siteRepository */
        $siteRepository = GeneralUtility::makeInstance(SiteRepository::class);

        // Autoselect the only one available site
        if (count($siteRepository->getAvailableSites()) == 1) {
            $this->selectedSite = $siteRepository->getFirstAvailableSite();
            $this->selectedPageUID = $this->selectedSite->getRootPageId();
            return;
        }

        if ($this->selectedPageUID < 1) {
            return;
        }

        try {
            $this->selectedSite = $siteRepository->getSiteByPageId($this->selectedPageUID);
        } catch (\InvalidArgumentException $exception) {
            return;
        }
    }
protected function initializeAction ( ) { parent :: initializeAction ( ) ; $ this -> solrConnectionManager = GeneralUtility :: makeInstance ( ConnectionManager :: class ) ; $ this -> moduleDataStorageService = GeneralUtility :: makeInstance ( ModuleDataStorageService :: class ) ; $ this -> selectedPageUID = ( int ) GeneralUtility :: _GP ( 'id' ) ; if ( $ this -> request -> hasArgument ( 'id' ) ) { $ this -> selectedPageUID = ( int ) $ this -> request -> getArgument ( 'id' ) ; } $ this -> requestedPageUID = $ this -> selectedPageUID ; /* @var SiteRepository $siteRepository */ $ siteRepository = GeneralUtility :: makeInstance ( SiteRepository :: class ) ; // Autoselect the only one available site if ( count ( $ siteRepository -> getAvailableSites ( ) ) == 1 ) { $ this -> selectedSite = $ siteRepository -> getFirstAvailableSite ( ) ; $ this -> selectedPageUID = $ this -> selectedSite -> getRootPageId ( ) ; return ; } if ( $ this -> selectedPageUID < 1 ) { return ; } try { $ this -> selectedSite = $ siteRepository -> getSiteByPageId ( $ this -> selectedPageUID ) ; } catch ( \ InvalidArgumentException $ exception ) { return ; } }
Initializes the controller and sets needed vars.
Initializes the controller and sets needed vars .