From 4e079fa96314321468f5c97283c49f22261708a2 Mon Sep 17 00:00:00 2001 From: dmh Date: Wed, 15 Mar 2017 17:33:59 +0200 Subject: [PATCH] [TASK] add new content element - Button --- Configuration/ContentElements/Button.pagets | 43 +++++++++++++++++++ Configuration/ContentElements/Button.setupts | 32 ++++++++++++++ Configuration/FlexForms/flexform_button.xml | 35 +++++++++++++++ Configuration/TCA/Overrides/tt_content.php | 41 ++++++++++++++++-- .../Private/Language/ContentElements.xlf | 30 +++++++++++++ .../Templates/ContentElements/Button.html | 14 ++++++ .../Icons/ContentElements/customElement.svg | 40 +++++++++++++++++ ext_tables.php | 2 + 8 files changed, 234 insertions(+), 3 deletions(-) create mode 100644 Configuration/ContentElements/Button.pagets create mode 100644 Configuration/ContentElements/Button.setupts create mode 100644 Configuration/FlexForms/flexform_button.xml create mode 100644 Resources/Private/Templates/ContentElements/Button.html create mode 100644 Resources/Public/Icons/ContentElements/customElement.svg diff --git a/Configuration/ContentElements/Button.pagets b/Configuration/ContentElements/Button.pagets new file mode 100644 index 00000000..de98e34c --- /dev/null +++ b/Configuration/ContentElements/Button.pagets @@ -0,0 +1,43 @@ +mod.wizards.newContentElement.wizardItems.contentElements { + elements { + button { + title = LLL:EXT:theme_t3kit/Resources/Private/Language/ContentElements.xlf:button.title + description = LLL:EXT:theme_t3kit/Resources/Private/Language/ContentElements.xlf:button.description + iconIdentifier = content-elements-button + tt_content_defValues { + CType = button + } + } + } + show := addToList(button) +} + +# Flexform selects +TCEFORM.tt_content.pi_flexform.button.sDEF.buttonSize { + addItems { + 0 = LLL:EXT:theme_t3kit/Resources/Private/Language/ContentElements.xlf:button.buttonSize_default + btn-lg = LLL:EXT:theme_t3kit/Resources/Private/Language/ContentElements.xlf:button.buttonSize_large + btn-sm = LLL:EXT:theme_t3kit/Resources/Private/Language/ContentElements.xlf:button.buttonSize_small + btn-xs = LLL:EXT:theme_t3kit/Resources/Private/Language/ContentElements.xlf:button.buttonSize_extraSmall + } +} + +# Use layout field to customize Layout select-box on button +# extend layout select-box only for this element +TCEFORM.tt_content.layout { + types { + button { + addItems { + --div-- = Button layouts: + # add value with index 0, to set it as a default, only for this element + 0 = Default + 11 = Primary + 12 = Success + 13 = Info + 14 = Warning + 15 = Danger + 16 = Link + } + } + } +} diff --git a/Configuration/ContentElements/Button.setupts b/Configuration/ContentElements/Button.setupts new file mode 100644 index 00000000..ecad7308 --- /dev/null +++ b/Configuration/ContentElements/Button.setupts @@ -0,0 +1,32 @@ +tt_content { + button =< lib.fluidContent + button { + templateName = Button + + dataProcessing { + + 10 = T3kit\T3kitExtensionTools\DataProcessing\FlexFormProcessor + 10 { + fieldName = pi_flexform + as = settings + } + # "inherit" from lib.fluidContent + 365 < lib.fluidContent.dataProcessing.365 + 1910 < lib.fluidContent.dataProcessing.1910 + + # extend class mapping only for this element + 1910 { + classMappings { + # Override the standard default + 0 = btn btn-default + 11 = btn btn-primary + 12 = btn btn-success + 13 = btn btn-info + 14 = btn btn-warning + 15 = btn btn-danger + 16 = btn btn-link + } + } + } + } +} diff --git a/Configuration/FlexForms/flexform_button.xml b/Configuration/FlexForms/flexform_button.xml new file mode 100644 index 00000000..20a6a86c --- /dev/null +++ b/Configuration/FlexForms/flexform_button.xml @@ -0,0 +1,35 @@ + + + 1 + + + + + + LLL:EXT:theme_t3kit/Resources/Private/Language/ContentElements.xlf:iconTextButton.flexform.sheetGeneral + + array + + + + + + select + + + + + + + + + + check + + + + + + + + diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index 38682c0a..ac5ce79d 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -224,15 +224,26 @@ 'heroImage', 'content-elements-heroImage' ], - 'copyrightText', + 'contacts', 'after' ); $GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']['heroImage'] = 'content-elements-heroImage'; - - + // "button" + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem( + 'tt_content', + 'CType', + [ + $contentElementLanguageFilePrefix . 'button.title', + 'button', + 'content-elements-button' + ], + 'heroImage', + 'after' + ); + $GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']['button'] = 'content-elements-button'; // The "divider" these content elements @@ -570,6 +581,26 @@ $GLOBALS['TCA']['tt_content']['types']['heroImage']['columnsOverrides']['bodytext']['config']['type'] = 'input'; + // "button" + $GLOBALS['TCA']['tt_content']['types']['button'] = [ + 'showitem' => ' + --palette--;' . $frontendLanguageFilePrefix . 'palette.general;general, + + header;' . $contentElementLanguageFilePrefix . 'button.header_label, + + --linebreak--, header_link;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header_link_formlabel, + --linebreak--,pi_flexform;' . $contentElementLanguageFilePrefix . 'tt_content.tabs.settings, + --div--;' . $frontendLanguageFilePrefix . 'tabs.appearance, + --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames, + --palette--;' . $frontendLanguageFilePrefix . 'palette.appearanceLinks;appearanceLinks, + --div--;' . $frontendLanguageFilePrefix . 'tabs.access, + hidden;' . $frontendLanguageFilePrefix . 'field.default.hidden, + --palette--;' . $frontendLanguageFilePrefix . 'palette.access;access, + --div--;' . $frontendLanguageFilePrefix . 'tabs.extended + ' + ]; + + // // Flexforms // @@ -600,6 +631,10 @@ // "contentElementSocialIcons" $GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds']['*,socialIcons'] = 'FILE:EXT:theme_t3kit/Configuration/FlexForms/flexform_socialIcons.xml'; + // "button" + $GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds']['*,button'] = 'FILE:EXT:theme_t3kit/Configuration/FlexForms/flexform_button.xml'; + + // Add additional fields for tt_content $additionalColumns = [ 'wrapper' => [ diff --git a/Resources/Private/Language/ContentElements.xlf b/Resources/Private/Language/ContentElements.xlf index 6da49a39..69ce76c4 100644 --- a/Resources/Private/Language/ContentElements.xlf +++ b/Resources/Private/Language/ContentElements.xlf @@ -430,6 +430,36 @@ Youtube: Pagelink + + + + + Button + + + A button with twbs style + + + Button text + + + Button Size + + + Default + + + Large + + + Small + + + Extra small + + + Block level button + diff --git a/Resources/Private/Templates/ContentElements/Button.html b/Resources/Private/Templates/ContentElements/Button.html new file mode 100644 index 00000000..32ac5fd7 --- /dev/null +++ b/Resources/Private/Templates/ContentElements/Button.html @@ -0,0 +1,14 @@ +
+ + + + + + + {data.header} + + + + +
+ diff --git a/Resources/Public/Icons/ContentElements/customElement.svg b/Resources/Public/Icons/ContentElements/customElement.svg new file mode 100644 index 00000000..50db6040 --- /dev/null +++ b/Resources/Public/Icons/ContentElements/customElement.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ext_tables.php b/ext_tables.php index c7510108..b74b4b70 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -19,6 +19,8 @@ 'content-elements-socialIcons' => 'socialIcons.svg', 'content-elements-copyrightText' => 'copyrightText.svg', 'content-elements-contacts' => 'contacts.svg', + 'content-elements-button' => 'customElement.svg', + 'content-elements-heroImage' => 'slider.svg', 'content-center-vertical-text-img-left' => 'content-center-vertical-text-img-left.svg', 'content-center-vertical-text-img-right' => 'content-center-vertical-text-img-right.svg', ];