Skip to content

Commit

Permalink
[FEATURE] Add extConf, add possibility to add your own typoscript, ad…
Browse files Browse the repository at this point in the history
…d possibiliy to show pallette frame. #26
  • Loading branch information
krausandre committed Feb 21, 2021
1 parent 4c226dd commit 91c90b9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Classes/Generator/TcaGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ public function setTca() :void
/***************
* Configure element type
*/
// Feature: enable pallette frame via extConf
$enableLayoutOptions = (bool)\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class)
->get('contentblocks_reg_api', 'enableLayoutOptions');
$GLOBALS['TCA']['tt_content']['types'][$contentBlock['CType']] = array_replace_recursive(
$GLOBALS['TCA']['tt_content']['types'][$contentBlock['CType']],
[
Expand All @@ -114,7 +117,8 @@ public function setTca() :void
--palette--;;general,
header,
content_block,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,' . (($enableLayoutOptions) ? '
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,' : '') . '
--palette--;;appearanceLinks,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
--palette--;;language,
Expand Down
9 changes: 9 additions & 0 deletions ext_conf_template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
################
### FEATURES ###
################

# cat=Features; type=string; label=contentBlockDefinition: Use our own definition, e. g. EXT:sitepackage/Configuration/TypoScript/contentBlock.typoscript
contentBlockDefinition = 0

# cat=Features; type=boolean; label=enableLayoutOptions: show layout (frame) options palette known from fluid_styled_content and bootstrap_package
enableLayoutOptions = 0
17 changes: 14 additions & 3 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,20 @@
);

// TypoScript
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup(
"@import 'EXT:contentblocks_reg_api/Configuration/TypoScript/setup.typoscript'"
);
// TODO: find a better way to add individuall definitions
$importTypoScriptTemplate = (string)\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class)
->get('contentblocks_reg_api', 'contentBlockDefinition');
if ( strlen('' . $importTypoScriptTemplate) > 2)
{
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup(
"@import '$importTypoScriptTemplate'"
);
}
else {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup(
"@import 'EXT:contentblocks_reg_api/Configuration/TypoScript/setup.typoscript'"
);
}

// contentBlocks
$contentBlocks = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
Expand Down

0 comments on commit 91c90b9

Please sign in to comment.