• Home
  • Services
  • Extensions
    • OAuth2 Server + Client
    • Cardealer
    • Questionaire
    • Sitepackage
  • Blog
  • Kontakt

Generate URI's with SiteFinder

10/15/2022 Extbase Backend

$siteFinder = GeneralUtility::makeInstance(SiteFinder::class); 
$site = $siteFinder->getSiteByPageId($this->settings['rootPid']);

$args = [
    '_language => 1,
    'tx_myextension' => [
        'controller' => 'List',
        'action' => 'list',
        'item' => 123,
    ]
];

$uri = $site->getRouter()->generateUri($this->settings['listPid'], $args);

 

Why should I use that instead of Extbase's UriBuilder?
Definilty if you need to generate links in a scheduler task class. Because the UriBuilder works in a task only if you execute them manually. By cron this will not work and the task failed automatically executed!

 

Back