Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Avoid deprecated EMU::addPageTSConfig() #1518

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ indent_size = 3
max_line_length = 80

# TypoScript
[*.typoscript]
[{*.typoscript,*.tsconfig}]
indent_style = space
indent_size = 4

Expand Down
1 change: 1 addition & 0 deletions Classes/ExpressionLanguage/ConditionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function __construct()
{
$this->expressionLanguageVariables = [
'extension' => GeneralUtility::makeInstance(ExtensionWrapper::class),
'extensionConfiguration' => GeneralUtility::makeInstance(ExtensionConfigurationWrapper::class),
];
}
}
31 changes: 31 additions & 0 deletions Classes/ExpressionLanguage/ExtensionConfigurationWrapper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
declare(strict_types = 1);

/*
* This file is part of the package bk2k/bootstrap-package.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

namespace BK2K\BootstrapPackage\ExpressionLanguage;

use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;

#[Autoconfigure(public: true)]
final class ExtensionConfigurationWrapper
{
public function __construct(
private readonly ExtensionConfiguration $extensionConfiguration,
) {
}

/**
* True if a bool toggle in ext_conf_template is true'ish.
*/
public function isToggleEnabled(string $extensionKey, string $extConfTemplateToggle): bool
{
return (bool)$this->extensionConfiguration->get($extensionKey, $extConfTemplateToggle);
}
}
29 changes: 29 additions & 0 deletions Configuration/page.tsconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[!extensionConfiguration.isToggleEnabled('bootstrap_package', 'disablePageTsContentElements')]
# Add Content Elements
@import 'EXT:bootstrap_package/Configuration/TsConfig/Page/ContentElement/All.tsconfig'
[end]

[!extensionConfiguration.isToggleEnabled('bootstrap_package', 'disablePageTsBackendLayouts')]
# Add BackendLayouts for the BackendLayout DataProvider
@import 'EXT:bootstrap_package/Configuration/TsConfig/Page/Mod/WebLayout/BackendLayouts.tsconfig'
[end]

[!extensionConfiguration.isToggleEnabled('bootstrap_package', 'disablePageTsRTE')]
# RTE
@import 'EXT:bootstrap_package/Configuration/TsConfig/Page/RTE.tsconfig'
[end]

[!extensionConfiguration.isToggleEnabled('bootstrap_package', 'disablePageTsTCADefaults')]
# TCADefaults
@import 'EXT:bootstrap_package/Configuration/TsConfig/Page/TCADefaults.tsconfig'
[end]

[!extensionConfiguration.isToggleEnabled('bootstrap_package', 'disablePageTsTCEMAIN')]
# TCEMAIN
@import 'EXT:bootstrap_package/Configuration/TsConfig/Page/TCEMAIN.tsconfig'
[end]

[!extensionConfiguration.isToggleEnabled('bootstrap_package', 'disablePageTsTCEFORM')]
# TCEFORM
@import 'EXT:bootstrap_package/Configuration/TsConfig/Page/TCEFORM.tsconfig'
[end]
32 changes: 0 additions & 32 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,6 @@
\TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class
);

// PageTS

// Add Content Elements
if (!(bool) $extensionConfiguration->get('bootstrap_package', 'disablePageTsContentElements')) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:bootstrap_package/Configuration/TsConfig/Page/ContentElement/All.tsconfig">');
}

// Add BackendLayouts for the BackendLayout DataProvider
if (!(bool) $extensionConfiguration->get('bootstrap_package', 'disablePageTsBackendLayouts')) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:bootstrap_package/Configuration/TsConfig/Page/Mod/WebLayout/BackendLayouts.tsconfig">');
}

// RTE
if (!(bool) $extensionConfiguration->get('bootstrap_package', 'disablePageTsRTE')) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:bootstrap_package/Configuration/TsConfig/Page/RTE.tsconfig">');
}

// TCADefaults
if (!(bool) $extensionConfiguration->get('bootstrap_package', 'disablePageTsTCADefaults')) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:bootstrap_package/Configuration/TsConfig/Page/TCADefaults.tsconfig">');
}

// TCEMAIN
if (!(bool) $extensionConfiguration->get('bootstrap_package', 'disablePageTsTCEMAIN')) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:bootstrap_package/Configuration/TsConfig/Page/TCEMAIN.tsconfig">');
}

// TCEFORM
if (!(bool) $extensionConfiguration->get('bootstrap_package', 'disablePageTsTCEFORM')) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:bootstrap_package/Configuration/TsConfig/Page/TCEFORM.tsconfig">');
}

// Register custom EXT:form configuration
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('form')) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup(trim('
Expand Down