diff --git a/Classes/Backend/PreviewRenderer/Video.php b/Classes/Backend/PreviewRenderer/Video.php new file mode 100644 index 0000000..fb1b0d1 --- /dev/null +++ b/Classes/Backend/PreviewRenderer/Video.php @@ -0,0 +1,55 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +use TYPO3\CMS\Backend\Preview\StandardContentPreviewRenderer; +use TYPO3\CMS\Backend\View\BackendLayout\Grid\GridColumnItem; +use TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor; +use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; +use TYPO3\CMS\Frontend\DataProcessing\FilesProcessor; + +class Video extends StandardContentPreviewRenderer +{ + public function renderPageModulePreviewContent(GridColumnItem $item): string + { + $record = $item->getRecord(); + + $contentObjectRenderer = new ContentObjectRenderer(); + $contentObjectRenderer->start($record, 'tt_content'); + + $record = (new ContentDataProcessor())->process($contentObjectRenderer, [ + 'dataProcessing.' => [ + '10' => FilesProcessor::class, + '10.' => [ + 'references.' => [ + 'fieldName' => 'media', + ], + 'as' => 'videos', + ], + ], + ], $record); + + $item->setRecord($record); + + return parent::renderPageModulePreviewContent($item); + } +} diff --git a/Configuration/PageTSconfig/Mod/Wizards/0_NewContentElement.tsconfig b/Configuration/PageTSconfig/Mod/Wizards/0_NewContentElement.tsconfig index 188cf4e..a9b248a 100644 --- a/Configuration/PageTSconfig/Mod/Wizards/0_NewContentElement.tsconfig +++ b/Configuration/PageTSconfig/Mod/Wizards/0_NewContentElement.tsconfig @@ -1,6 +1,6 @@ mod.wizards.newContentElement.wizardItems { common { - show = text, image + show = text, image, video elements { image { @@ -26,6 +26,6 @@ mod.wizards.newContentElement.wizardItems { } TCEFORM.tt_content { CType { - keepItems := addToList(text, image, menu_abstract, menu_subpages) + keepItems := addToList(text, image, video, menu_abstract, menu_subpages) } } diff --git a/Configuration/PageTSconfig/Mod/Wizards/Video.tsconfig b/Configuration/PageTSconfig/Mod/Wizards/Video.tsconfig new file mode 100644 index 0000000..d7f2719 --- /dev/null +++ b/Configuration/PageTSconfig/Mod/Wizards/Video.tsconfig @@ -0,0 +1,19 @@ +mod { + wizards.newContentElement.wizardItems.common { + elements { + video { + iconIdentifier = content-media + title = Video + description = Displays a Video + tt_content_defValues { + CType = video + } + } + } + show := addToList(video) + } + web_layout.tt_content.preview.video = EXT:ds_site/Resources/Private/Templates/Backend/ContentElements/Video.html +} +TCEFORM.tt_content { + CType.keepItems := addToList(video) +} diff --git a/Configuration/TCA/Overrides/tt_content_video.php b/Configuration/TCA/Overrides/tt_content_video.php new file mode 100644 index 0000000..870de24 --- /dev/null +++ b/Configuration/TCA/Overrides/tt_content_video.php @@ -0,0 +1,52 @@ + [ + 'typeicon_classes' => [ + $contentType => 'content-media', + ], + ], + 'types' => [ + $contentType => [ + 'showitem' => implode(',', [ + '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general', + '--palette--;;general', + ' --palette--;;headers', + 'media', + '--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance', + '--palette--;;frames', + '--palette--;;appearanceLinks', + '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language', + '--palette--;;language', + '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access', + '--palette--;;hidden', + '--palette--;;access', + '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories', + 'categories', + '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes', + 'rowDescription', + '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended', + ]), + 'previewRenderer' => Video::class, + ], + ], + ]); + + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem( + $tableName, + 'CType', + [ + $languagePath . $contentType, + $contentType, + 'content-media', + 'default' + ], + 'image', + 'after' + ); +})('ds_site', 'tt_content', 'video'); diff --git a/Configuration/TypoScript/Setup/ContentElements/Video.typoscript b/Configuration/TypoScript/Setup/ContentElements/Video.typoscript new file mode 100644 index 0000000..dd507e4 --- /dev/null +++ b/Configuration/TypoScript/Setup/ContentElements/Video.typoscript @@ -0,0 +1,16 @@ +tt_content.video =< lib.contentElement +tt_content.video { + templateName = Video + + dataProcessing { + 10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor + 10 { + references.fieldName = media + as = videos + } + } + + stdWrap { + editIcons := appendString(media) + } +} diff --git a/Resources/Private/Language/locallang_tca.xlf b/Resources/Private/Language/locallang_tca.xlf index 06ba84e..a0d3941 100644 --- a/Resources/Private/Language/locallang_tca.xlf +++ b/Resources/Private/Language/locallang_tca.xlf @@ -9,6 +9,9 @@ Admonition + + Video + diff --git a/Resources/Private/Partials/Image.html b/Resources/Private/Partials/Image.html index 08e51cb..28ae5d3 100644 --- a/Resources/Private/Partials/Image.html +++ b/Resources/Private/Partials/Image.html @@ -1,6 +1,5 @@ -
Figure i{image.originalFile.uid}: {image.description}
diff --git a/Resources/Private/Partials/Video.html b/Resources/Private/Partials/Video.html new file mode 100644 index 0000000..125a444 --- /dev/null +++ b/Resources/Private/Partials/Video.html @@ -0,0 +1,16 @@ + +
+ +
+

Video v{video.originalFile.uid}: {video.title}

+

{video.description -> f:format.nl2br()}

+
+
+ diff --git a/Resources/Private/Sass/Backend/index.scss b/Resources/Private/Sass/Backend/index.scss index 9025b53..5e80f53 100644 --- a/Resources/Private/Sass/Backend/index.scss +++ b/Resources/Private/Sass/Backend/index.scss @@ -16,3 +16,10 @@ color: #fff; } } + +.exampleContent { + video { + width: 40rem; + max-width: 100%; + } +} diff --git a/Resources/Private/Sass/Frontend/components/_video.scss b/Resources/Private/Sass/Frontend/components/_video.scss new file mode 100644 index 0000000..bae3638 --- /dev/null +++ b/Resources/Private/Sass/Frontend/components/_video.scss @@ -0,0 +1,3 @@ +video { + max-width: 100%; +} diff --git a/Resources/Private/Sass/Frontend/index.scss b/Resources/Private/Sass/Frontend/index.scss index 3cbb574..3fbc8cc 100644 --- a/Resources/Private/Sass/Frontend/index.scss +++ b/Resources/Private/Sass/Frontend/index.scss @@ -30,3 +30,4 @@ @import "components/feedit"; @import "components/ckeditor"; @import "components/admonition"; +@import "components/video"; diff --git a/Resources/Private/Templates/Backend/ContentElements/Video.html b/Resources/Private/Templates/Backend/ContentElements/Video.html new file mode 100644 index 0000000..aad6073 --- /dev/null +++ b/Resources/Private/Templates/Backend/ContentElements/Video.html @@ -0,0 +1,22 @@ + + + +
+ +
+

+ Video v{video.originalFile.uid}: {video.title}
+ {video.description -> f:format.nl2br()} +

+
+
+
+
+ diff --git a/Resources/Private/Templates/ContentElements/Video.html b/Resources/Private/Templates/ContentElements/Video.html new file mode 100644 index 0000000..ff5c524 --- /dev/null +++ b/Resources/Private/Templates/ContentElements/Video.html @@ -0,0 +1,11 @@ + + + {f:layout(name: 'Default')} + + + + {f:render(partial: 'Video', arguments: {video: video})} + + + diff --git a/Resources/Public/Backend/Css/index.css b/Resources/Public/Backend/Css/index.css index b2a141d..11cc52d 100644 --- a/Resources/Public/Backend/Css/index.css +++ b/Resources/Public/Backend/Css/index.css @@ -1 +1 @@ -.typo3-login .panel,.typo3-login .panel-footer{background-color:rgba(0,0,0,.2)}.typo3-login input{color:#9cd9f0;border-color:#9cd9f0;background-color:#2e3436}.typo3-login .form-control:focus{border-color:#77dfd8}.typo3-login a{color:#fff} \ No newline at end of file +.typo3-login .panel,.typo3-login .panel-footer{background-color:rgba(0,0,0,.2)}.typo3-login input{color:#9cd9f0;border-color:#9cd9f0;background-color:#2e3436}.typo3-login .form-control:focus{border-color:#77dfd8}.typo3-login a{color:#fff}.exampleContent video{width:40rem;max-width:100%} \ No newline at end of file diff --git a/Resources/Public/Js/feedit-modal.js b/Resources/Public/Js/feedit-modal.js new file mode 100644 index 0000000..b4821b1 --- /dev/null +++ b/Resources/Public/Js/feedit-modal.js @@ -0,0 +1,7 @@ +window.TYPO3.Feedit = { + openBackendHandler: function (event) { + event.preventDefault(); + console.log(event); + }, +}; +