Skip to content

Commit

Permalink
[BUGFIX] Fixed the ModuleTemplate template paths for all backend modu…
Browse files Browse the repository at this point in the history
…les, added condition for tx_yoastseo_related_focuskeyword to not include auto generated columns in 13
  • Loading branch information
RinyVT committed Sep 26, 2024
1 parent 9833842 commit ba07cc3
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 53 deletions.
4 changes: 2 additions & 2 deletions Classes/Controller/AbstractBackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class AbstractBackendController extends ActionController
/**
* @param array<string, mixed> $data
*/
protected function returnResponse(array $data = [], ModuleTemplate $moduleTemplate = null): ResponseInterface
protected function returnResponse(string $template, array $data = [], ModuleTemplate $moduleTemplate = null): ResponseInterface
{
$data['layout'] = GeneralUtility::makeInstance(Typo3Version::class)
->getMajorVersion() < 13 ? 'Default' : 'Module';
Expand All @@ -39,7 +39,7 @@ protected function returnResponse(array $data = [], ModuleTemplate $moduleTempla
$moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->getPageInformation());

$moduleTemplate->assignMultiple($data);
return $moduleTemplate->renderResponse();
return $moduleTemplate->renderResponse($template);
}

protected function getModuleTemplate(): ModuleTemplate
Expand Down
2 changes: 1 addition & 1 deletion Classes/Controller/CrawlerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct(
public function indexAction(): ResponseInterface
{
$this->addYoastJavascriptConfig();
return $this->returnResponse(['sites' => $this->siteFinder->getAllSites()]);
return $this->returnResponse('Crawler/Index', ['sites' => $this->siteFinder->getAllSites()]);
}

public function resetProgressAction(int $site, int $language):? ResponseInterface
Expand Down
2 changes: 1 addition & 1 deletion Classes/Controller/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ class DashboardController extends AbstractBackendController
{
public function indexAction(): ResponseInterface
{
return $this->returnResponse();
return $this->returnResponse('Dashboard/Index');
}
}
4 changes: 2 additions & 2 deletions Classes/Controller/OverviewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function listAction(int $currentPage = 1): ResponseInterface
$overviewData = $this->getOverviewData($currentPage) + ['action' => 'list'];
$moduleTemplate = $this->getModuleTemplate();
if (!isset($overviewData['pageInformation'])) {
return $this->returnResponse($overviewData, $moduleTemplate);
return $this->returnResponse('Overview/List', $overviewData, $moduleTemplate);
}

$moduleTemplate->getDocHeaderComponent()->setMetaInformation($overviewData['pageInformation']);
Expand All @@ -47,7 +47,7 @@ public function listAction(int $currentPage = 1): ResponseInterface
$moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($languageMenu);
}

return $this->returnResponse($overviewData, $moduleTemplate);
return $this->returnResponse('Overview/List', $overviewData, $moduleTemplate);
}

/**
Expand Down
35 changes: 24 additions & 11 deletions Configuration/TCA/tx_yoastseo_related_focuskeyword.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php

use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\GeneralUtility;

$llPrefix = 'LLL:EXT:yoast_seo/Resources/Private/Language/TCA.xlf:';

return [
$focusKeywordTca = [
'ctrl' => [
'title' => $llPrefix . 'tx_yoastseo_related_focuskeyword.title',
'label' => 'keyword',
Expand All @@ -25,16 +28,6 @@
],
],
'columns' => [
'sys_language_uid' => $GLOBALS['TCA']['tt_content']['columns']['sys_language_uid'],
'l10n_parent' => array_replace_recursive($GLOBALS['TCA']['tt_content']['columns']['l18n_parent'], [
'config' => [
'foreign_table' => 'tx_yoastseo_related_focuskeyword',
'foreign_table_where' => 'AND tx_yoastseo_related_focuskeyword.pid=###CURRENT_PID### AND tx_yoastseo_related_focuskeyword.sys_language_uid IN (-1,0)',
]
]),
'l10n_source' => $GLOBALS['TCA']['tt_content']['columns']['l10n_source'],
'l10n_diffsource' => $GLOBALS['TCA']['tt_content']['columns']['l18n_diffsource'],
'hidden' => $GLOBALS['TCA']['tt_content']['columns']['hidden'],
'keyword' => [
'exclude' => 1,
'l10n_mode' => 'prefixLangTitle',
Expand Down Expand Up @@ -92,3 +85,23 @@
]
],
];

if (GeneralUtility::makeInstance(Typo3Version::class)->getMajorVersion() < 13) {
$focusKeywordTca['columns'] = array_merge(
$focusKeywordTca['columns'],
[
'sys_language_uid' => $GLOBALS['TCA']['tt_content']['columns']['sys_language_uid'],
'l10n_parent' => array_replace_recursive($GLOBALS['TCA']['tt_content']['columns']['l18n_parent'], [
'config' => [
'foreign_table' => 'tx_yoastseo_related_focuskeyword',
'foreign_table_where' => 'AND tx_yoastseo_related_focuskeyword.pid=###CURRENT_PID### AND tx_yoastseo_related_focuskeyword.sys_language_uid IN (-1,0)',
]
]),
'l10n_source' => $GLOBALS['TCA']['tt_content']['columns']['l10n_source'],
'l10n_diffsource' => $GLOBALS['TCA']['tt_content']['columns']['l18n_diffsource'],
'hidden' => $GLOBALS['TCA']['tt_content']['columns']['hidden'],
]
);
}

return $focusKeywordTca;
3 changes: 3 additions & 0 deletions Configuration/page.tsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
templates.yoast-seo-for-typo3/yoast_seo {
10 = yoast-seo-for-typo3/yoast_seo:Resources/Private
}
10 changes: 0 additions & 10 deletions Resources/Private/Templates/Dashboard/Legacy.html

This file was deleted.

24 changes: 0 additions & 24 deletions Resources/Private/Templates/Overview/Legacy.html

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<f:section name="main">
<div class="widget-table-wrapper">
<table class="widget-table">
<table class="widget-table table table-striped table-hover">
<tr>
<th><f:translate key="LLL:EXT:yoast_seo/Resources/Private/Language/BackendModule.xlf:page" /></th>
<th><f:translate key="LLL:EXT:yoast_seo/Resources/Private/Language/BackendModule.xlf:lastChange" /></th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<f:section name="main">
<div class="widget-table-wrapper">
<table class="widget-table">
<table class="widget-table table table-striped table-hover">
<tr>
<th><f:translate key="LLL:EXT:yoast_seo/Resources/Private/Language/BackendModule.xlf:page" /></th>
<th><f:translate key="LLL:EXT:yoast_seo/Resources/Private/Language/BackendModule.xlf:lastChange" /></th>
Expand Down

0 comments on commit ba07cc3

Please sign in to comment.