Skip to content
Snippets Groups Projects
Verified Commit 24c6c8cf authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[TASK] Fix extension scanner issues

parent 153db594
No related branches found
No related tags found
1 merge request!15[TASK] Prepare for TYPO3 12
......@@ -436,4 +436,13 @@ class PluginController {
public function getContentObjectRenderer(): ContentObjectRenderer {
return $this->cObj;
}
public function getConf(): array {
return $this->conf;
}
public function setConf(array $conf): PluginController {
$this->conf = $conf;
return $this;
}
}
......@@ -26,12 +26,13 @@
namespace SGalinski\DfTabs\DataProvider;
use Doctrine\DBAL\Exception;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\Exception\AspectNotFoundException;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\Exception\ContentRenderingException;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
/**
* Database Data Provider
......@@ -57,22 +58,26 @@ abstract class AbstractDataBaseDataProvider extends AbstractBaseDataProvider {
* @param int $uid
* @return array
* @throws AspectNotFoundException
* @throws Exception
*/
protected function getRecordData($uid) {
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->table);
$row = $queryBuilder->select('*')
->from($this->table)->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)))->executeQuery()->fetch();
->from($this->table)
->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT)))
->executeQuery()->fetchAssociative();
/** @var TypoScriptFrontendController $typoscriptController */
$typoscriptController = $GLOBALS['TSFE'];
$context = GeneralUtility::makeInstance(Context::class);
$languageAspect = $context->getAspect('language');
$sysLanguageContent = $languageAspect->getContentId();
$sysLanguageContentOl = $languageAspect->getOverlayType();
if (\is_array($row) && $row['sys_language_uid'] !== $sysLanguageContent &&
$sysLanguageContentOl
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
if (
\is_array($row)
&& $row['sys_language_uid'] !== $sysLanguageContent
&& $sysLanguageContentOl
) {
$row = $typoscriptController->sys_page->getLanguageOverlay(
$row = $pageRepository->getLanguageOverlay(
$this->table,
$row,
$languageAspect
......
......@@ -37,7 +37,7 @@ class ConfigurationService {
/**
* @var PluginController
*/
protected PluginController $controllerContext;
protected PluginController $pluginController;
/**
* Injects the controller context
......@@ -45,8 +45,8 @@ class ConfigurationService {
* @param PluginController $context
* @return void
*/
public function injectControllerContext(PluginController $context): void {
$this->controllerContext = $context;
public function injectPluginController(PluginController $context): void {
$this->pluginController = $context;
}
/**
......@@ -97,14 +97,14 @@ class ConfigurationService {
* @return array
*/
protected function getTypoScriptConfiguration(): array {
$configuration = $this->controllerContext->conf;
$configuration = $this->pluginController->getConf();
foreach ($configuration as $key => &$option) {
$dotKey = $key . '.';
if (
isset($configuration[$dotKey]) &&
$key[\strlen($key) - 1] !== '.'
) {
$option = $this->controllerContext->getContentObjectRenderer()->stdWrap($option, $configuration[$dotKey]);
$option = $this->pluginController->getContentObjectRenderer()->stdWrap($option, $configuration[$dotKey]);
}
}
......@@ -127,27 +127,27 @@ class ConfigurationService {
* @return array
*/
protected function getFlexformConfiguration(): array {
$data = &$this->controllerContext->getContentObjectRenderer()->data['pi_flexform'];
$data = &$this->pluginController->getContentObjectRenderer()->data['pi_flexform'];
$configuration = [];
$value = \trim($this->controllerContext->pi_getFFvalue($data, 'enableAutoPlay'));
$value = \trim($this->pluginController->pi_getFFvalue($data, 'enableAutoPlay'));
if ($value !== '') {
$configuration['enableAutoPlay'] = $value;
}
$value = \trim($this->controllerContext->pi_getFFvalue($data, 'enableMouseOver'));
$value = \trim($this->pluginController->pi_getFFvalue($data, 'enableMouseOver'));
if ($value !== '') {
$configuration['enableMouseOver'] = $value;
}
$value = \trim($this->controllerContext->pi_getFFvalue($data, 'autoPlayInterval'));
$value = \trim($this->pluginController->pi_getFFvalue($data, 'autoPlayInterval'));
if ($value !== '') {
$configuration['autoPlayInterval'] = (int) $value;
}
// this has to be a try catch for now, since animationSpeed was never a Setting inside of our flexform.
// when the Plugin has not been updated, this will stay, throwing an error in php8+
try {
$value = \trim($this->controllerContext->pi_getFFvalue($data, 'animationSpeed'));
$value = \trim($this->pluginController->pi_getFFvalue($data, 'animationSpeed'));
if ($value !== '') {
$configuration['animationSpeed'] = (int) $value;
}
......@@ -155,12 +155,12 @@ class ConfigurationService {
$configuration['animationSpeed'] = 0;
}
$value = \trim($this->controllerContext->pi_getFFvalue($data, 'mode'));
$value = \trim($this->pluginController->pi_getFFvalue($data, 'mode'));
if ($value !== '') {
$configuration['mode'] = $value;
}
$value = \trim($this->controllerContext->pi_getFFvalue($data, 'titles'));
$value = \trim($this->pluginController->pi_getFFvalue($data, 'titles'));
if ($value !== '') {
$configuration['titles'] = \explode(\chr(10), $value);
}
......@@ -168,7 +168,7 @@ class ConfigurationService {
### BEGIN Compatibility Code ###
// try catch for reasons explained above
try {
$value = \trim($this->controllerContext->pi_getFFvalue($data, 'pages'));
$value = \trim($this->pluginController->pi_getFFvalue($data, 'pages'));
if ($value !== '') {
$configuration['data'] = $value;
}
......@@ -177,7 +177,7 @@ class ConfigurationService {
}
try {
$value = \trim($this->controllerContext->pi_getFFvalue($data, 'tt_content'));
$value = \trim($this->pluginController->pi_getFFvalue($data, 'tt_content'));
if ($value !== '') {
$configuration['data'] = $value;
}
......@@ -186,12 +186,12 @@ class ConfigurationService {
}
### END Compatibility Code ###
$value = \trim($this->controllerContext->pi_getFFvalue($data, 'data'));
$value = \trim($this->pluginController->pi_getFFvalue($data, 'data'));
if ($value !== '') {
$configuration['data'] = $value;
}
$value = \trim($this->controllerContext->pi_getFFvalue($data, 'hashName'));
$value = \trim($this->pluginController->pi_getFFvalue($data, 'hashName'));
if ($value !== '') {
$configuration['hashName'] = $value;
}
......
......@@ -31,6 +31,7 @@ use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
/**
* Renders the content
......@@ -223,7 +224,7 @@ class TypoScriptView implements SingletonInterface {
$linkId = $this->pluginConfiguration[$tabId]['hashName'] . $index;
$typolink = $target = '';
if (\strpos($menuEntry, '###LINK###') !== FALSE) {
if (str_contains($menuEntry, '###LINK###')) {
$typolink = $this->contentObject->typoLink(
'',
[
......@@ -242,28 +243,29 @@ class TypoScriptView implements SingletonInterface {
$target = ($target === '' ? '_self' : $target);
}
/** @var TypoScriptFrontendController $typoscriptFrontendController */
$typoscriptFrontendController = $GLOBALS['TSFE'];
$linkAnchor = '#' . $linkId;
$hash = $linkAnchor;
if (\strpos($menuEntry, '###LINK_ANCHOR###') !== FALSE &&
$GLOBALS['TSFE']->config['baseURL'] !== ''
if (
str_contains($menuEntry, '###LINK_ANCHOR###') &&
$typoscriptFrontendController->config['baseURL'] !== ''
) {
$linkAnchor = $this->contentObject->typoLink(
'',
[
'parameter' => $GLOBALS['TSFE']->id,
'parameter' => $typoscriptFrontendController->getRequestedId(),
'section' => $linkId,
'returnLast' => 'url'
]
);
}
$menuEntry = \str_replace(
return \str_replace(
['###CLASSES###', '###ID###', '###LINK_ANCHOR###', '###LINK_ID###', '###LINK###', '###TARGET###', '###HASH###'],
[$classes, $id, $linkAnchor, $linkId, $typolink, $target, $hash],
$menuEntry
);
return $menuEntry;
}
/**
......
......@@ -11,7 +11,7 @@
"issues": "https://gitlab.sgalinski.de/typo3/df_tabs/issues"
},
"require": {
"typo3/cms-core": "^11.5 || ^12.4"
"typo3/cms-core": "^12.4"
},
"replace": {
"sgalinski/df_tabs": "self.version"
......
......@@ -21,7 +21,7 @@ $EM_CONF['df_tabs'] = [
'author_company' => 'sgalinski Internet Services',
'constraints' => [
'depends' => [
'typo3' => '11.5.0-12.4.99',
'typo3' => '12.4.0-12.4.99',
'php' => '8.1.0-8.3.99',
],
'conflicts' => [
......
<?php
use SGalinski\DfTabs\Controller\PluginController;
use SGalinski\DfTabs\Hooks\PageLayoutView\PluginRenderer;
use SGalinski\DfTabs\Preview\PreviewRenderer;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
call_user_func(
......
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