diff --git a/Classes/DataProcessing/BootstrapProcessor.php b/Classes/DataProcessing/BootstrapProcessor.php index e84c7ad9..d273d280 100644 --- a/Classes/DataProcessing/BootstrapProcessor.php +++ b/Classes/DataProcessing/BootstrapProcessor.php @@ -50,7 +50,7 @@ class BootstrapProcessor implements DataProcessorInterface { const TX_CONTAINER_GRID = 'two_columns,three_columns,four_columns,six_columns,row_columns'; - const T3SBS_ELEMENTS = 't3sbs_mediaobject,t3sbs_card,t3sbs_carousel,t3sbs_button,t3sbs_fluidtemplate,t3sbs_gallery,t3sbs_toast'; + const T3SBS_ELEMENTS = 't3sbs_mediaobject,t3sbs_card,t3sbs_carousel,t3sbs_button,t3sbs_fluidtemplate,t3sbs_gallery,t3sbs_toast,t3sbs_assets'; const TX_CONTAINER = 'button_group,background_wrapper,parallax_wrapper,autoLayout_row,container,carousel_container,collapsible_container,collapsible_accordion,modal,tabs_container,tabs_tab,listGroup_wrapper,masonry_wrapper,swiper_container,toast_container,card_wrapper'; /** @@ -157,6 +157,13 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu $processedData = GeneralUtility::makeInstance(Toast::class) ->getProcessedData($processedData, $flexconf); } + if ( $cType == 't3sbs_assets' ) { + $pi_flexconf = $flexFormService->convertFlexFormContentToArray($processedData['data']['pi_flexform']); + if (!empty($pi_flexconf)) { + $processedData['assets']['jquery'] = $pi_flexconf['settings']['jquery']; + $processedData['assets']['priority'] = $pi_flexconf['settings']['priority']; + } + } #if ( $cType == 't3sbs_fluidtemplate' ) {} #if ( $cType == 't3sbs_gallery' ) {} } diff --git a/Classes/Hooks/FlexFormHook.php b/Classes/Hooks/FlexFormHook.php index b4605b20..3959f4fa 100644 --- a/Classes/Hooks/FlexFormHook.php +++ b/Classes/Hooks/FlexFormHook.php @@ -11,21 +11,35 @@ * For the full copyright and license information, please read the * LICENSE file that was distributed with this source code. */ -class NewsFlexFormHook +class FlexFormHook { public function parseDataStructureByIdentifierPostProcess(array $dataStructure, array $identifier): array { + $extconf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('t3sbootstrap'); - if ($identifier['type'] === 'tca' && $identifier['tableName'] === 'tt_content' - && ($identifier['dataStructureKey'] === 'news_pi1,list' || $identifier['dataStructureKey'] === '*,news_pi1' - || $identifier['dataStructureKey'] === '*,news_newsdetail') ) { - $file = Environment::getPublicPath() . '/typo3conf/ext/t3sbootstrap/Resources/Private/Extensions/news/Configuration/FlexForms/News.xml'; - $content = file_get_contents($file); - if ($content) { - $dataStructure['sheets']['extraEntry'] = GeneralUtility::xml2array($content); + $ffPath = '/fileadmin/T3SB/FlexForms/'; + + foreach ( $GLOBALS['TCA']['tt_content']['columns']['tx_t3sbootstrap_flexform']['config']['ds'] as $key=>$flexForm ) { + + $flexForms[$key] = substr($flexForm, 46, -4); } - } - return $dataStructure; + + if ( array_key_exists($identifier['dataStructureKey'],$flexForms) ) { + + if ($identifier['type'] === 'tca' && $identifier['tableName'] === 'tt_content' + && $identifier['fieldName'] === 'tx_t3sbootstrap_flexform' && $identifier['dataStructureKey']) { + + $file = Environment::getPublicPath() . $ffPath.$flexForms[$identifier['dataStructureKey']].'.xml'; + + $content = file_exists($file) ? file_get_contents($file) : ''; + + if ($content) { + $dataStructure['sheets']['extraEntry'] = GeneralUtility::xml2array($content); + } + } + } + + return $dataStructure; } } diff --git a/Classes/Hooks/NewsFlexFormHook.php b/Classes/Hooks/NewsFlexFormHook.php index dcc079e4..b4605b20 100644 --- a/Classes/Hooks/NewsFlexFormHook.php +++ b/Classes/Hooks/NewsFlexFormHook.php @@ -18,7 +18,8 @@ public function parseDataStructureByIdentifierPostProcess(array $dataStructure, { if ($identifier['type'] === 'tca' && $identifier['tableName'] === 'tt_content' - && ($identifier['dataStructureKey'] === 'news_pi1,list' || $identifier['dataStructureKey'] === '*,news_pi1') ) { + && ($identifier['dataStructureKey'] === 'news_pi1,list' || $identifier['dataStructureKey'] === '*,news_pi1' + || $identifier['dataStructureKey'] === '*,news_newsdetail') ) { $file = Environment::getPublicPath() . '/typo3conf/ext/t3sbootstrap/Resources/Private/Extensions/news/Configuration/FlexForms/News.xml'; $content = file_get_contents($file); if ($content) { diff --git a/Configuration/FlexForms/AssetInline.xml b/Configuration/FlexForms/AssetInline.xml new file mode 100644 index 00000000..d5ada088 --- /dev/null +++ b/Configuration/FlexForms/AssetInline.xml @@ -0,0 +1,33 @@ + + + + + array + + Inline JavaScript Settings + + array + + + + + Enable if you use jquery. + + check + + + + + + + Define whether the JavaScript should be put in the <head> tag above-the-fold or somewhere in the body part. + + check + + + + + + + + diff --git a/Configuration/Icons.php b/Configuration/Icons.php index 67630a7e..e806bb70 100644 --- a/Configuration/Icons.php +++ b/Configuration/Icons.php @@ -1,10 +1,15 @@ [ - 'provider' => \TYPO3\CMS\Core\Imaging\IconProvider\FontawesomeIconProvider::class, - 'name' => 'bars', - 'additionalClasses' => 'fa-solid fa-bars', + 'buttongroup' => [ + 'provider' => \TYPO3\CMS\Core\Imaging\IconProvider\FontawesomeIconProvider::class, + 'name' => 'bars', + 'additionalClasses' => 'fa-solid fa-bars', + ], + + 'cssJsIcon' => [ + 'provider' => \TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class, + 'source' => 'EXT:t3sbootstrap/Resources/Public/Icons/Register/css-javascript.png', ], ]; diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index e9b63906..e3316e3a 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -481,6 +481,17 @@ /*************** * Add new CTypes */ + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem( + 'tt_content', + 'CType', + [ + 'Plain CSS or JavaScript inline', + 't3sbs_assets', + 'cssJsIcon', + ], + 'textmedia', + 'after' +); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem( 'tt_content', 'CType', @@ -1249,6 +1260,47 @@ unset($tempContentColumns); +/*************** + * Assets Inline + */ +$GLOBALS['TCA']['tt_content']['types']['t3sbs_assets'] = [ + 'showitem' => ' + --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general, + --palette--;;general, + header; Internal title (not displayed), + --div--;Java Script, + bodytext;JavaScript, + pi_flexform; Inline JavaScript Settings, + --div--;CSS, + tx_t3sbootstrap_bodytext;CSS, + --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access, + --palette--;;hidden + ', + 'columnsOverrides' => [ + 'bodytext' => [ + 'config' => [ + 'format' => 'javascript', + 'renderType' => 't3editor', + 'wrap' => 'off', + ], + ], + 'tx_t3sbootstrap_bodytext' => [ + 'config' => [ + 'format' => 'css', + 'renderType' => 't3editor', + 'wrap' => 'off', + ], + ], + ], +]; + +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( + '*', + 'FILE:EXT:t3sbootstrap/Configuration/FlexForms/AssetInline.xml', + 't3sbs_assets' +); + + /*************** * Button - t3sbs_button */ diff --git a/Configuration/TSConfig/NewContentElements.tsconfig b/Configuration/TSConfig/NewContentElements.tsconfig index e61f459a..15673670 100644 --- a/Configuration/TSConfig/NewContentElements.tsconfig +++ b/Configuration/TSConfig/NewContentElements.tsconfig @@ -7,6 +7,14 @@ mod.wizards { common.elements { textmedia.tt_content_defValues.imageorient = 0 } + special.elements { + t3sbsassets { + iconIdentifier = cssJsIcon + title = Plain CSS or JavaScript + description = With this element you can insert raw JS or CSS code on the page. + tt_content_defValues.CType = t3sbs_assets + } + } t3sbs { header = LLL:EXT:t3sbootstrap/Resources/Private/Language/locallang_be.xlf:t3sbs_contentelements elements { @@ -58,3 +66,5 @@ mod.wizards { } } } +mod.wizards.newContentElement.wizardItems.special.show := addToList(t3sbsassets) + diff --git a/Configuration/TSConfig/Page.tsconfig b/Configuration/TSConfig/Page.tsconfig index afbb8fd7..69497cb4 100644 --- a/Configuration/TSConfig/Page.tsconfig +++ b/Configuration/TSConfig/Page.tsconfig @@ -1,3 +1,15 @@ + +#------------------------------------------------------------------------------- +# Include +#------------------------------------------------------------------------------- +mod.web_layout { + tt_content { + preview { + t3sbs_assets = EXT:t3sbootstrap/Resources/Private/Templates/Preview/t3sbs_assets.html + } + } +} + #------------------------------------------------------------------------------- # Include #------------------------------------------------------------------------------- @@ -141,6 +153,7 @@ TCEFORM.tt_content { t3sbs_carousel.disabled = 1 t3sbs_toast.disabled = 1 collapsible_accordion.disabled = 1 + t3sbs_assets.disabled = 1 } } header_position { @@ -292,12 +305,14 @@ TCEFORM.tt_content { types { t3sbs_button.disabled = 1 t3sbs_toast.disabled = 1 + t3sbs_assets.disabled = 1 } } tx_t3sbootstrap_bgcolor { types { t3sbs_button.disabled = 1 t3sbs_toast.disabled = 1 + t3sbs_assets.disabled = 1 t3sbs_carousel { label.default = Caption background color (use with opacity - image link and zoom did not work) label.de = Caption background color (use with opacity - image link and zoom did not work) @@ -307,12 +322,14 @@ TCEFORM.tt_content { tx_t3sbootstrap_header_fontawesome { types { t3sbs_toast.disabled = 1 + t3sbs_assets.disabled = 1 } } tx_t3sbootstrap_bgopacity { types { t3sbs_button.disabled = 1 t3sbs_toast.disabled = 1 + t3sbs_assets.disabled = 1 t3sbs_carousel { label.default = Opacity for Caption background color label.de = Opacity for Caption background color @@ -324,6 +341,7 @@ TCEFORM.tt_content { t3sbs_button.disabled = 1 t3sbs_carousel.disabled = 1 t3sbs_toast.disabled = 1 + t3sbs_assets.disabled = 1 } } @@ -331,18 +349,26 @@ TCEFORM.tt_content { types { t3sbs_button.disabled = 1 t3sbs_toast.disabled = 1 + t3sbs_assets.disabled = 1 t3sbs_carousel { label.default = Text color for caption label.de = Text color for caption } } } + + tx_t3sbootstrap_extra_class { + types { + t3sbs_assets.disabled = 1 + } + } tx_t3sbootstrap_padding_sides { types { t3sbs_carousel.disabled = 1 t3sbs_toast.disabled = 1 toast_container.disabled = 1 + t3sbs_assets.disabled = 1 } } tx_t3sbootstrap_padding_size { @@ -350,6 +376,7 @@ TCEFORM.tt_content { t3sbs_carousel.disabled = 1 t3sbs_toast.disabled = 1 toast_container.disabled = 1 + t3sbs_assets.disabled = 1 } } tx_t3sbootstrap_margin_sides { @@ -357,6 +384,7 @@ TCEFORM.tt_content { t3sbs_carousel.disabled = 1 t3sbs_toast.disabled = 1 toast_container.disabled = 1 + t3sbs_assets.disabled = 1 } } tx_t3sbootstrap_margin_size { @@ -364,6 +392,7 @@ TCEFORM.tt_content { t3sbs_carousel.disabled = 1 t3sbs_toast.disabled = 1 toast_container.disabled = 1 + t3sbs_assets.disabled = 1 } } tx_t3sbootstrap_container { @@ -371,8 +400,14 @@ TCEFORM.tt_content { t3sbs_carousel.disabled = 1 t3sbs_toast.disabled = 1 collapsible_accordion.disabled = 1 + t3sbs_assets.disabled = 1 } } + tx_t3sbootstrap_flexform { + types { + t3sbs_assets.disabled = 1 + } + } tx_t3sbootstrap_inTextImgRowWidth { types { t3sbs_card.disabled = 1 @@ -453,5 +488,20 @@ TCEFORM.tt_content { t3sbs_button.disabled = 1 } } + tx_content_animations_animation { + types { + t3sbs_assets.disabled = 1 + } + } + tx_content_animations_duration { + types { + t3sbs_assets.disabled = 1 + } + } + tx_content_animations_delay { + types { + t3sbs_assets.disabled = 1 + } + } } diff --git a/Configuration/TypoScript/ContentElement/Bootstrap.typoscript b/Configuration/TypoScript/ContentElement/Bootstrap.typoscript index e5d8a797..a9f350a1 100644 --- a/Configuration/TypoScript/ContentElement/Bootstrap.typoscript +++ b/Configuration/TypoScript/ContentElement/Bootstrap.typoscript @@ -3,6 +3,13 @@ # =============================================================================== tt_content { + # ********************************************************** + # Assets Inline + # ********************************************************** + t3sbs_assets =< lib.contentElement + t3sbs_assets.templateName = AssetsInline + t3sbs_assets.stdWrap.editIcons = tt_content + # ********************************************************** # BOOTSTAP: Button # ********************************************************** diff --git a/Resources/Private/Templates/Content/AssetsInline.html b/Resources/Private/Templates/Content/AssetsInline.html new file mode 100644 index 00000000..69067539 --- /dev/null +++ b/Resources/Private/Templates/Content/AssetsInline.html @@ -0,0 +1,24 @@ + + + + +/* t3sbs_assets_{data.uid} */ +{data.tx_t3sbootstrap_bodytext -> f:format.raw()} + + + + + + + + + {data.bodytext -> f:format.raw()} + + + + + {data.bodytext -> f:format.raw()} + + + + diff --git a/Resources/Private/Templates/Preview/t3sbs_assets.html b/Resources/Private/Templates/Preview/t3sbs_assets.html new file mode 100644 index 00000000..e0a284b4 --- /dev/null +++ b/Resources/Private/Templates/Preview/t3sbs_assets.html @@ -0,0 +1,16 @@ + + + + +

Javascript:
+ {bodytext}

+
+ + +
+
+ + +

CSS:
+{tx_t3sbootstrap_bodytext}

+
diff --git a/Resources/Public/Icons/Register/css-javascript.png b/Resources/Public/Icons/Register/css-javascript.png new file mode 100644 index 00000000..2df50315 Binary files /dev/null and b/Resources/Public/Icons/Register/css-javascript.png differ diff --git a/ext_emconf.php b/ext_emconf.php index 591a85ab..ef587ebc 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -14,7 +14,7 @@ 'title' => 'Bootstrap Components', 'description' => 'Startup extension to use bootstrap 5 classes, components and more out of the box. Example and info: www.t3sbootstrap.de', 'category' => 'templates', - 'version' => '5.2.10', + 'version' => '5.2.11', 'state' => 'stable', 'clearCacheOnLoad' => true, 'author' => 'Helmut Hackbarth',