Skip to content

Instantly share code, notes, and snippets.

@smichaelsen
Last active February 13, 2017 18:25
Show Gist options
  • Save smichaelsen/0f0cf4763908145499754b166469b51f to your computer and use it in GitHub Desktop.
Save smichaelsen/0f0cf4763908145499754b166469b51f to your computer and use it in GitHub Desktop.
<?php
declare(strict_types = 1);
namespace Smichalsen\Gist;
use FluidTYPO3\Fluidpages\Provider\PageProvider;
use FluidTYPO3\Fluidpages\Service\ConfigurationService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
class FluxUtility
{
public function getPageControllerAction(): string
{
return $this->getPageProvider()->getControllerActionFromRecord($this->getTyposcriptFrontendController()->page);
}
protected function getPageProvider(): PageProvider
{
static $pageProvider;
if (!$pageProvider instanceof PageProvider) {
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$fluidPagesConfigurationService = $objectManager->get(ConfigurationService::class);
$pageProvider = $fluidPagesConfigurationService->resolvePageProvider($this->getTyposcriptFrontendController()->page);
}
return $pageProvider;
}
protected function getTyposcriptFrontendController(): TypoScriptFrontendController
{
return $GLOBALS['TSFE'];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment