260 lines
12 KiB
PHP
260 lines
12 KiB
PHP
<?php
|
||
|
||
/*
|
||
* 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.
|
||
*/
|
||
|
||
defined('TYPO3_MODE') || die();
|
||
|
||
/***************
|
||
* Define TypoScript as content rendering template
|
||
*/
|
||
$GLOBALS['TYPO3_CONF_VARS']['FE']['contentRenderingTemplates'][] = 'bootstrappackage/Configuration/TypoScript/';
|
||
$GLOBALS['TYPO3_CONF_VARS']['FE']['contentRenderingTemplates'][] = 'bootstrappackage/Configuration/TypoScript/ContentElement/';
|
||
|
||
/***************
|
||
* Make the extension configuration accessible
|
||
*/
|
||
$extensionConfiguration = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
|
||
\TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class
|
||
);
|
||
$bootstrapPackageConfiguration = $extensionConfiguration->get('bootstrap_package');
|
||
|
||
/***************
|
||
* PageTS
|
||
*/
|
||
|
||
// Add Content Elements
|
||
if (!(bool) $bootstrapPackageConfiguration['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) $bootstrapPackageConfiguration['disablePageTsBackendLayouts']) {
|
||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:bootstrap_package/Configuration/TsConfig/Page/Mod/WebLayout/BackendLayouts.tsconfig">');
|
||
}
|
||
|
||
// RTE
|
||
if (!(bool) $bootstrapPackageConfiguration['disablePageTsRTE']) {
|
||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:bootstrap_package/Configuration/TsConfig/Page/RTE.tsconfig">');
|
||
}
|
||
|
||
// TCEMAIN
|
||
if (!(bool) $bootstrapPackageConfiguration['disablePageTsTCEMAIN']) {
|
||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:bootstrap_package/Configuration/TsConfig/Page/TCEMAIN.tsconfig">');
|
||
}
|
||
|
||
// TCEFORM
|
||
if (!(bool) $bootstrapPackageConfiguration['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('
|
||
module.tx_form {
|
||
settings {
|
||
yamlConfigurations {
|
||
110 = EXT:bootstrap_package/Configuration/Form/Setup.yaml
|
||
}
|
||
}
|
||
}
|
||
plugin.tx_form {
|
||
settings {
|
||
yamlConfigurations {
|
||
110 = EXT:bootstrap_package/Configuration/Form/Setup.yaml
|
||
}
|
||
}
|
||
}
|
||
'));
|
||
}
|
||
|
||
if (TYPO3_MODE === 'BE') {
|
||
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
|
||
|
||
/**
|
||
* Provide example webserver configuration after extension is installed.
|
||
*/
|
||
$signalSlotDispatcher->connect(
|
||
\TYPO3\CMS\Extensionmanager\Utility\InstallUtility::class,
|
||
'afterExtensionInstall',
|
||
\BK2K\BootstrapPackage\Service\InstallService::class,
|
||
'generateApacheHtaccess'
|
||
);
|
||
|
||
/**
|
||
* Add backend styling
|
||
*/
|
||
$signalSlotDispatcher->connect(
|
||
\TYPO3\CMS\Extensionmanager\Utility\InstallUtility::class,
|
||
'afterExtensionInstall',
|
||
\BK2K\BootstrapPackage\Service\BrandingService::class,
|
||
'setBackendStyling'
|
||
);
|
||
|
||
/**
|
||
* Add current Bootstrap Package version to system information toolbar
|
||
*/
|
||
$signalSlotDispatcher->connect(
|
||
\TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem::class,
|
||
'getSystemInformation',
|
||
\BK2K\BootstrapPackage\Backend\ToolbarItem\VersionToolbarItem::class,
|
||
'addVersionInformation'
|
||
);
|
||
}
|
||
|
||
/***************
|
||
* Register google font hook
|
||
*/
|
||
if (!(bool) $bootstrapPackageConfiguration['disableGoogleFontCaching']) {
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][\BK2K\BootstrapPackage\Hooks\PageRenderer\GoogleFontHook::class]
|
||
= \BK2K\BootstrapPackage\Hooks\PageRenderer\GoogleFontHook::class . '->execute';
|
||
}
|
||
|
||
/***************
|
||
* Register css processing parser
|
||
*/
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/bootstrap-package/css']['parser'][\BK2K\BootstrapPackage\Parser\ScssParser::class] =
|
||
\BK2K\BootstrapPackage\Parser\ScssParser::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/bootstrap-package/css']['parser'][\BK2K\BootstrapPackage\Parser\LessParser::class] =
|
||
\BK2K\BootstrapPackage\Parser\LessParser::class;
|
||
|
||
/***************
|
||
* Register css processing hooks
|
||
*/
|
||
if (!(bool) $bootstrapPackageConfiguration['disableCssProcessing']) {
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][\BK2K\BootstrapPackage\Hooks\PageRenderer\PreProcessHook::class]
|
||
= \BK2K\BootstrapPackage\Hooks\PageRenderer\PreProcessHook::class . '->execute';
|
||
}
|
||
|
||
/***************
|
||
* Register font loader
|
||
*/
|
||
if (!(bool) $bootstrapPackageConfiguration['disableFontLoader']) {
|
||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptConstants(implode(LF, [
|
||
'# customsubcategory=98=Preloader',
|
||
'page.preloader {',
|
||
' # cat=bootstrap package: preloader/98/1_enable; type=boolean; label=Preloader: Enable to display the preloader',
|
||
' enable = 1',
|
||
' logo {',
|
||
' # cat=bootstrap package: preloader/98/2_logo_file; type=string; label=Logo: Leave blank to don´t show a logo',
|
||
' file = EXT:bootstrap_package/Resources/Public/Images/BootstrapPackageInverted.svg',
|
||
' # cat=bootstrap package: preloader/98/3_logo_height; type=int+; label=Height: The image will not be resized!',
|
||
' height = 52',
|
||
' # cat=bootstrap package: preloader/98/4_logo_width; type=int+; label=Width: The image will not be resized!',
|
||
' width = 180',
|
||
' }',
|
||
' # cat=bootstrap package: preloader/98/5_background_color; type=color; label=Background Color',
|
||
' backgroundColor = #333333',
|
||
' # cat=bootstrap package: preloader/98/6_fade_duration; type=string; label=Fade duration',
|
||
' fadeDuration = 0.25',
|
||
'}'
|
||
]));
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][\BK2K\BootstrapPackage\Hooks\PageRenderer\FontLoaderHook::class]
|
||
= \BK2K\BootstrapPackage\Hooks\PageRenderer\FontLoaderHook::class . '->execute';
|
||
}
|
||
|
||
/***************
|
||
* Add default RTE configuration for bootstrap package
|
||
*/
|
||
$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['bootstrap'] = 'EXT:bootstrap_package/Configuration/RTE/Default.yaml';
|
||
|
||
/***************
|
||
* Extend TYPO3 upgrade wizards to handle bootstrap package specific upgrades
|
||
*/
|
||
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\TYPO3\CMS\Install\Updates\SectionFrameToFrameClassUpdate::class])) {
|
||
unset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\TYPO3\CMS\Install\Updates\SectionFrameToFrameClassUpdate::class]);
|
||
}
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\AccordionContentElementUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\AccordionContentElementUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\AccordionMediaOrientUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\AccordionMediaOrientUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\BackendLayoutUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\BackendLayoutUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\BulletContentElementUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\BulletContentElementUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\CarouselContentElementUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\CarouselContentElementUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\CarouselItemTypeUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\CarouselItemTypeUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\ExternalMediaContentElementUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\ExternalMediaContentElementUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\FrameClassUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\FrameClassUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\FrameClassToBackgroundUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\FrameClassToBackgroundUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\ListGroupContentElementUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\ListGroupContentElementUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\PanelContentElementUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\PanelContentElementUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\TabContentElementUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\TabContentElementUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\TabMediaOrientUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\TabMediaOrientUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\TableContentElementUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\TableContentElementUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\TexticonContentElementUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\TexticonContentElementUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\TexticonSizeUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\TexticonSizeUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\TexticonTypeUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\TexticonTypeUpdate::class;
|
||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][\BK2K\BootstrapPackage\Updates\TexticonIconUpdate::class]
|
||
= \BK2K\BootstrapPackage\Updates\TexticonIconUpdate::class;
|
||
|
||
/***************
|
||
* Register "bk2k" as global fluid namespace
|
||
*/
|
||
$GLOBALS['TYPO3_CONF_VARS']['SYS']['fluid']['namespaces']['bk2k'][] = 'BK2K\\BootstrapPackage\\ViewHelpers';
|
||
|
||
/***************
|
||
* Register Icons
|
||
*/
|
||
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
|
||
$iconRegistry->registerIcon(
|
||
'systeminformation-bootstrappackage',
|
||
\TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
|
||
['source' => 'EXT:bootstrap_package/Resources/Public/Icons/SystemInformation/bootstrappackage.svg']
|
||
);
|
||
$icons = [
|
||
'accordion',
|
||
'accordion-item',
|
||
'card-group',
|
||
'card-group-item',
|
||
'carousel',
|
||
'carousel-item',
|
||
'carousel-item-backgroundimage',
|
||
'carousel-item-calltoaction',
|
||
'carousel-item-header',
|
||
'carousel-item-html',
|
||
'carousel-item-image',
|
||
'carousel-item-text',
|
||
'carousel-item-textandimage',
|
||
'beside-text-img-centered-left',
|
||
'beside-text-img-centered-right',
|
||
'csv',
|
||
'externalmedia',
|
||
'icon-group',
|
||
'icon-group-item',
|
||
'listgroup',
|
||
'menu-card',
|
||
'social-links',
|
||
'tab',
|
||
'tab-item',
|
||
'texticon',
|
||
'timeline',
|
||
'timeline-item'
|
||
];
|
||
foreach ($icons as $icon) {
|
||
$iconRegistry->registerIcon(
|
||
'content-bootstrappackage-' . $icon,
|
||
\TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
|
||
['source' => 'EXT:bootstrap_package/Resources/Public/Icons/ContentElements/' . $icon . '.svg']
|
||
);
|
||
}
|