phptypo3extbaserealurl

Speaking url (realurl) links not rendering in extbase extension


I am developing an extbase extension to expose the site menu structure in json format. PageRepository gives me the relevant page uids and titles so the only remaining challenge is building correct URLs. I am using typoLink to do this but instead of getting speaking urls (which are rendered correctly if I browse the site) the output is in the form of index.php?id=[uid]. Here is my code:

$data = $this->pageRepository->getMenu(1);
$this->cObj = $GLOBALS['TSFE']->cObj;
$retval = array();

foreach ($data as $key => $row)
{
    $pageUid = $row['uid'];
    $conf = array('parameter'=>$pageUid, 'returnLast'=>'url');
    $uri = $this->cObj->typoLink('', $conf);
    array_push($retval, array('title' => $row['title'], 'url' => $uri));
}

Realurl 2.3.2

Typo3 8.7.11

Any ideas?


Solution

  • If you use a pageType to render your Extbase JSON response, have you checked if config.tx_realurl_enable = 1 is set for this pageType?