Skip to content
Snippets Groups Projects
Commit 54a50ab1 authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[BUGFIX] Fix sitemap generation

parent 8ad06e71
No related branches found
No related tags found
1 merge request!23Feature upgrade to typo3 10
......@@ -2,9 +2,12 @@
namespace SGalinski\SgJobs\Service;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\Languagevisibility\Exception\TableNotSupportedException;
......@@ -53,25 +56,28 @@ class SitemapService {
->execute();
$rows = $databaseResource->fetchAll();
$context = GeneralUtility::makeInstance(Context::class);
foreach ($rows as $row) {
$jobs = $this->getJobsByPid($row['pages'], $sysLanguageUid);
foreach ($jobs as $job) {
$url = $GLOBALS['TSFE']->cObj->typoLink_URL(
[
'parameter' => $row['pid'],
'linkAccessRestrictedPages' => 1,
'forceAbsoluteUrl' => 1,
'additionalParams' => GeneralUtility::implodeArrayForUrl(
NULL, ['tx_sgjobs_jobapplication[jobId]' => $job['uid']]
),
]
);
$pageList[] = [
'url' => htmlspecialchars($url),
'title' => ''
];
try {
$site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId($row['pid']);
$jobs = $this->getJobsByPid($row['pages'], $sysLanguageUid);
foreach ($jobs as $job) {
$url = $site->getRouter($context)->generateUri(
$row['pid'],
[
'_language' => $context->getPropertyFromAspect('language', 'id', 0),
'tx_sgjobs_jobapplication' => [
'jobId' => $job['uid']
]
]
);
$pageList[] = [
'url' => htmlspecialchars($url),
'title' => ''
];
}
} catch (SiteNotFoundException $exception) {
// No site configuration for the page found
}
}
return $pageList;
......
......@@ -26,15 +26,16 @@ namespace SGalinski\SgJobs\ViewHelpers\Backend\Widget;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use SGalinski\SgRoutes\ViewHelpers\Backend\Widget\Controller\PaginateController;
use SGalinski\SgJobs\ViewHelpers\Backend\Widget\Controller\PaginateController;
use TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetViewHelper;
use TYPO3\CMS\Fluid\Core\Widget\Exception\MissingControllerException;
/**
* Class PaginateViewHelper
*/
class PaginateViewHelper extends AbstractWidgetViewHelper {
/**
* @var \SGalinski\SgRoutes\ViewHelpers\Backend\Widget\Controller\PaginateController
* @var PaginateController
*/
protected $controller;
......@@ -72,7 +73,7 @@ class PaginateViewHelper extends AbstractWidgetViewHelper {
* Renders the paginator
*
* @return string
* @throws \TYPO3\CMS\Fluid\Core\Widget\Exception\MissingControllerException
* @throws MissingControllerException
*/
public function render(): string {
return $this->initiateSubRequest();
......
services:
_defaults:
autowire: true
autoconfigure: true
public: false
SGalinski\SgJobs\:
resource: '../Classes/*'
SGalinski\SgJobs\Service\SitemapService:
public: true
SGalinski\SgJobs\Service\BackendService:
public: true
SGalinski\SgJobs\Event\Listener\AccessPageListEventListener:
tags:
- name: event.listener
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment