From 10e91dd5d7c276f4a5c7cb25f06999c895755d16 Mon Sep 17 00:00:00 2001
From: Michael Kessler <michael.kessler@sgalinski.de>
Date: Tue, 15 Dec 2020 16:30:26 +0100
Subject: [PATCH] [TASK] Add plugin to content element wizard

---
 .../Page/NewContentElementWizard.tsconfig       | 17 +++++++++++++++++
 Resources/Private/Language/de.locallang.xlf     |  8 ++++++++
 Resources/Private/Language/locallang.xlf        |  6 ++++++
 Resources/Public/Icons/youtube.svg              |  1 +
 ext_localconf.php                               | 14 ++++++++++++++
 5 files changed, 46 insertions(+)
 create mode 100644 Configuration/TsConfig/Page/NewContentElementWizard.tsconfig
 create mode 100644 Resources/Public/Icons/youtube.svg

diff --git a/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig b/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig
new file mode 100644
index 0000000..ccdc32c
--- /dev/null
+++ b/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig
@@ -0,0 +1,17 @@
+mod {
+	wizards.newContentElement.wizardItems.plugins {
+		elements {
+			youtube {
+				iconIdentifier = extension-sg_youtube
+				title = LLL:EXT:sg_youtube/Resources/Private/Language/locallang.xlf:youtubePluginTitle
+				description = LLL:EXT:sg_youtube/Resources/Private/Language/locallang.xlf:youtubePluginDescription
+				tt_content_defValues {
+					CType = list
+					list_type = sgyoutube_youtube
+				}
+			}
+		}
+
+		show = *
+	}
+}
diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf
index 63dcd63..f96688d 100644
--- a/Resources/Private/Language/de.locallang.xlf
+++ b/Resources/Private/Language/de.locallang.xlf
@@ -81,6 +81,14 @@
 				<source><![CDATA[Settings]]></source>
 				<target><![CDATA[Einstellungen]]></target>
 			</trans-unit>
+			<trans-unit id="youtubePluginDescription" approved="yes">
+				<source><![CDATA[Display one or multiple YouTube videos.]]></source>
+				<target><![CDATA[Zeige ein oder mehrere YouTube-Videos an.]]></target>
+			</trans-unit>
+			<trans-unit id="youtubePluginTitle" approved="yes">
+				<source><![CDATA[YouTube]]></source>
+				<target><![CDATA[YouTube]]></target>
+			</trans-unit>
 		</body>
 	</file>
 </xliff>
diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf
index 3355721..6a3d8fc 100644
--- a/Resources/Private/Language/locallang.xlf
+++ b/Resources/Private/Language/locallang.xlf
@@ -62,6 +62,12 @@
 			<trans-unit id="settings">
 				<source><![CDATA[Settings]]></source>
 			</trans-unit>
+			<trans-unit id="youtubePluginDescription">
+				<source><![CDATA[Display one or multiple YouTube videos.]]></source>
+			</trans-unit>
+			<trans-unit id="youtubePluginTitle">
+				<source><![CDATA[YouTube]]></source>
+			</trans-unit>
 		</body>
 	</file>
 </xliff>
diff --git a/Resources/Public/Icons/youtube.svg b/Resources/Public/Icons/youtube.svg
new file mode 100644
index 0000000..4dac28e
--- /dev/null
+++ b/Resources/Public/Icons/youtube.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z" fill="#c4302b"/></svg>
diff --git a/ext_localconf.php b/ext_localconf.php
index 85fbea4..71c8207 100644
--- a/ext_localconf.php
+++ b/ext_localconf.php
@@ -40,6 +40,20 @@ if (!defined('TYPO3_MODE')) {
 
 	]
 );
+
+//include Plugin sg_twitter
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
+	'@import "EXT:sg_youtube/Configuration/TsConfig/Page/NewContentElementWizard.tsconfig"'
+);
+
+//Register Icons
+$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
+$iconRegistry->registerIcon(
+	'extension-sg_youtube',
+	\TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
+	['source' => 'EXT:sg_youtube/Resources/Public/Icons/youtube.svg']
+);
+
 //Hooks
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['sg_youtube']
 	= \SGalinski\SgYoutube\Hooks\PageLayoutView\PluginRenderer::class;
-- 
GitLab