Skip to content
Snippets Groups Projects
Commit 762a6f66 authored by Georgi's avatar Georgi
Browse files

[TASK] TYPO3 v13 Support

parent 3abaa0aa
No related branches found
No related tags found
1 merge request!16Feature/typo3 v13 support
......@@ -48,11 +48,6 @@ class YoutubeController extends ActionController {
*/
protected $youtubeService;
/**
* @var EventDispatcherInterface
*/
protected $eventDispatcher;
/**
* Injects the YouTube service
*
......@@ -106,6 +101,13 @@ class YoutubeController extends ActionController {
}
}
$typo3Version = VersionNumberUtility::getCurrentTypo3Version();
if (version_compare($typo3Version, '13.0.0', '<')) {
$disableYoutubeCache = (bool) GeneralUtility::_GP('disableYoutubeCache');
} else {
$disableYoutubeCache = (bool) ($this->request->getParsedBody()['disableYoutubeCache'] ?? $this->request->getQueryParams()['disableYoutubeCache'] ?? null);
}
// Add third-party filters
$filterInstances = $this->handleFrontendFilters($filterValues);
......@@ -121,7 +123,7 @@ class YoutubeController extends ActionController {
// Use the possibly modified parameters
$jsonArray = $this->youtubeService->getJsonAsArray(
new FilterParameterBag($youtubeParameters, $filterInstances)
new FilterParameterBag($youtubeParameters, $filterInstances, $disableYoutubeCache)
);
// Dispatch the AfterYoutubeCallEvent
......
......@@ -36,7 +36,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
class AfterBackendPageRenderEventListener {
public function __invoke(AfterBackendPageRenderEvent $event) {
if (!LicenceCheckService::isTYPO3VersionSupported()
|| LicenceCheckService::isInDevelopmentContext()
|| LicenceCheckService::isInDevelopmentContext()
) {
return;
}
......
......@@ -28,10 +28,12 @@ namespace SGalinski\SgYoutube\Filter;
class FilterParameterBag {
protected array $parameters;
protected array $filterInstances;
protected bool $disableCache = FALSE;
public function __construct(array $parameters = [], array $filterInstances = []) {
public function __construct(array $parameters = [], array $filterInstances = [], bool $disableCache = FALSE) {
$this->parameters = $parameters;
$this->filterInstances = $filterInstances;
$this->disableCache = $disableCache;
}
public function get(string $key, $default = NULL) {
......@@ -61,4 +63,14 @@ class FilterParameterBag {
public function setFilterInstances(array $filterInstances): void {
$this->filterInstances = $filterInstances;
}
public function getDisableCache(): bool
{
return $this->disableCache;
}
public function setDisableCache(bool $disableCache): void
{
$this->disableCache = $disableCache;
}
}
......@@ -329,7 +329,9 @@ class YoutubeService {
$url = $parameterBag->get('url', $this->getApiUrl($parameters, $parameterBag->getFilterInstances()));
$cacheKey = 'sg_youtube' . sha1($url);
$disableYoutubeCache = (bool) GeneralUtility::_GP('disableYoutubeCache');
$disableYoutubeCache = $parameterBag->getDisableCache();
if (!$disableYoutubeCache) {
$cachedResult = $this->cache->get($cacheKey);
if ($cachedResult) {
......
......@@ -47,6 +47,7 @@ class FlexFormUtility {
// Get the TypoScript configuration for the site
$typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
$typoScriptArray = $fullTypoScript;
$pluginSettings = $typoScriptService->convertTypoScriptArrayToPlainArray(
$typoScriptArray['plugin.']['tx_sgyoutube.']['settings.']
);
......
......@@ -6,8 +6,12 @@ use TYPO3\CMS\Extbase\Utility\ExtensionUtility;
$pluginSignature = ExtensionUtility::registerPlugin(
'SgYoutube',
'Youtube',
'YouTube Videos'
'YouTube Videos',
'extension-sg_youtube',
'plugins',
'LLL:EXT:sg_youtube/Resources/Private/Language/locallang.xlf:youtubePluginDescription'
);
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
ExtensionManagementUtility::addPiFlexFormValue(
$pluginSignature,
......
......@@ -35,7 +35,7 @@ $EM_CONF['sg_youtube'] = [
'version' => '8.0.0',
'constraints' => [
'depends' => [
'typo3' => '12.4.0-12.4.99',
'typo3' => '12.4.0-13.4.99',
'php' => '8.1.0-8.3.99',
],
'conflicts' => [],
......
......@@ -5,6 +5,7 @@ use SGalinski\SgYoutube\Form\Element\LicenceStatus;
use SGalinski\SgYoutube\Hooks\LicenceCheckHook;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Extbase\Utility\ExtensionUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_youtube']['uncached'] ?? FALSE) {
// Uncached version
......@@ -29,10 +30,13 @@ if ($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sg_youtube']['uncached'] ?? FALSE
);
}
// include Plugin sg_twitter
ExtensionManagementUtility::addPageTSConfig(
'@import "EXT:sg_youtube/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig"'
);
$currentTypo3Version = VersionNumberUtility::getCurrentTypo3Version();
if (version_compare($currentTypo3Version, '13.0.0', '<')) {
// include Plugin sg_youtube
ExtensionManagementUtility::addPageTSConfig(
'@import "EXT:sg_youtube/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig"'
);
}
// Caching
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['sgyoutube_cache'] ??= [];
......
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