From ddbb0c35b0f70498237c7d5d8bd3660db565cfbf Mon Sep 17 00:00:00 2001 From: Philipp Dieter Date: Fri, 9 Feb 2024 11:04:01 +0100 Subject: [PATCH] [FEATURE] Add backend for loading translations via ajax --- Classes/Controller/ActionController.php | 27 +++- Classes/Controller/TranslationController.php | 57 +++++++++ Classes/Domain/Model/Translation.php | 20 +++ .../FlexForms/flexform_translation.xml | 28 ++++ .../tx_templatesaide_domain_model_dummy.php | 2 +- ...templatesaide_domain_model_translation.php | 120 ++++++++++++++++++ Configuration/TypoScript/constants.ts | 17 ++- Configuration/TypoScript/setup.ts | 29 ++++- Documentation.tmpl/Configuration/Index.rst | 30 ++--- ExtensionBuilder.json | 58 ++++++++- Resources/Private/Language/locallang.xlf | 31 ++--- Resources/Private/Language/locallang_db.xlf | 25 +++- Resources/Private/TypoScript/Setup/page.ts | 16 +++ ...templatesaide_domain_model_translation.gif | Bin 0 -> 230 bytes Resources/Public/Icons/user_plugin_dummy.svg | 5 +- .../Public/Icons/user_plugin_translation.svg | 4 + .../Icons/user_plugin_translationplugin.svg | 4 + .../Controller/TranslationControllerTest.php | 30 +++++ Tests/Unit/Domain/Model/TranslationTest.php | 34 +++++ ext_localconf.php | 68 +++++++--- ext_tables.php | 12 +- ext_tables.sql | 77 +++++++++++ 22 files changed, 625 insertions(+), 69 deletions(-) create mode 100644 Classes/Controller/TranslationController.php create mode 100644 Classes/Domain/Model/Translation.php create mode 100644 Configuration/FlexForms/flexform_translation.xml create mode 100644 Configuration/TCA/tx_templatesaide_domain_model_translation.php create mode 100644 Resources/Public/Icons/tx_templatesaide_domain_model_translation.gif create mode 100644 Resources/Public/Icons/user_plugin_translation.svg create mode 100644 Resources/Public/Icons/user_plugin_translationplugin.svg create mode 100644 Tests/Unit/Controller/TranslationControllerTest.php create mode 100644 Tests/Unit/Domain/Model/TranslationTest.php diff --git a/Classes/Controller/ActionController.php b/Classes/Controller/ActionController.php index 05884f3..cffa6ea 100644 --- a/Classes/Controller/ActionController.php +++ b/Classes/Controller/ActionController.php @@ -141,6 +141,11 @@ class ActionController extends BaseController */ protected $propertyMapperConfigurationBuilder; + /** + * translation extensions + */ + protected $translations = []; + /** * @param \TYPO3\CMS\Extbase\Service\ExtensionService $extensionService */ @@ -616,10 +621,26 @@ class ActionController extends BaseController $this->request->getControllerActionName(), $pluginArguments ); + $uriTranslation = $this->getControllerContext() + ->getUriBuilder() + ->reset() + ->setCreateAbsoluteUri(true) + ->setAddQueryString(true) + ->setTargetPageType(6001) + ->uriFor( + 'translations', + [ + 'extensions' => $this->translations, + ], + 'Translation', + 'TemplatesAide', + 'Translationplugin' + ); $this->ajaxEnv = [ - 'uri' => $uri, - 'object' => $object, - 'namespace' => $this->getPluginNamespace(), + 'uri' => $uri, + 'uriTranslation' => $uriTranslation, + 'object' => $object, + 'namespace' => $this->getPluginNamespace(), ]; } diff --git a/Classes/Controller/TranslationController.php b/Classes/Controller/TranslationController.php new file mode 100644 index 0000000..bb43ae4 --- /dev/null +++ b/Classes/Controller/TranslationController.php @@ -0,0 +1,57 @@ + + * + ***/ + +use TYPO3\CMS\Core\Localization\LocalizationFactory; +use TYPO3\CMS\Core\Utility\GeneralUtility; + +/** + * TranslationController + */ +class TranslationController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController +{ + + protected static $locallangPath = 'Resources/Private/Language/'; + + /** + * action translations + * + * @param array $extensions + * @return void + */ + public function translationsAction($extensions = []) + { + $result = []; + foreach ($extensions as $extension) { + $langfilePath = 'EXT:' + . GeneralUtility::camelCaseToLowerCaseUnderscored($extension) + . '/' + . self::$locallangPath + . 'locallang.xlf'; + $languageFactory = GeneralUtility::makeInstance( + LocalizationFactory::class + ); + $langfileContent = $languageFactory->getParsedData( + $langfilePath, + $GLOBALS['LANG']->lang + ); + $langfileResult = []; + foreach (reset($langfileContent) as $key => $row) { + $langfileResult[$key] = reset($row)['target']; + } + $result[$extension] = $langfileResult; + } + $GLOBALS['TSFE']->setContentType('application/json'); + return json_encode($result); + } +} diff --git a/Classes/Domain/Model/Translation.php b/Classes/Domain/Model/Translation.php new file mode 100644 index 0000000..63434fc --- /dev/null +++ b/Classes/Domain/Model/Translation.php @@ -0,0 +1,20 @@ + + * + ***/ +/** + * Translation + */ +class Translation extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity +{ +} diff --git a/Configuration/FlexForms/flexform_translation.xml b/Configuration/FlexForms/flexform_translation.xml new file mode 100644 index 0000000..209af0b --- /dev/null +++ b/Configuration/FlexForms/flexform_translation.xml @@ -0,0 +1,28 @@ + + + + + + Function + + array + + + + + + select + + + Translation + Translation->translations + + + + + + + + + + \ No newline at end of file diff --git a/Configuration/TCA/tx_templatesaide_domain_model_dummy.php b/Configuration/TCA/tx_templatesaide_domain_model_dummy.php index 8535a5a..91906e3 100644 --- a/Configuration/TCA/tx_templatesaide_domain_model_dummy.php +++ b/Configuration/TCA/tx_templatesaide_domain_model_dummy.php @@ -23,7 +23,7 @@ return [ 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, ', ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, , --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => ['showitem' => ', --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language, sys_language_uid, l10n_parent, l10n_diffsource, --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access, hidden, starttime, endtime'], ], 'columns' => [ 'sys_language_uid' => [ diff --git a/Configuration/TCA/tx_templatesaide_domain_model_translation.php b/Configuration/TCA/tx_templatesaide_domain_model_translation.php new file mode 100644 index 0000000..930089f --- /dev/null +++ b/Configuration/TCA/tx_templatesaide_domain_model_translation.php @@ -0,0 +1,120 @@ + [ + 'title' => 'LLL:EXT:templates_aide/Resources/Private/Language/locallang_db.xlf:tx_templatesaide_domain_model_translation', + 'label' => 'uid', + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'cruser_id' => 'cruser_id', + 'versioningWS' => true, + 'languageField' => 'sys_language_uid', + 'transOrigPointerField' => 'l10n_parent', + 'transOrigDiffSourceField' => 'l10n_diffsource', + 'delete' => 'deleted', + 'enablecolumns' => [ + 'disabled' => 'hidden', + 'starttime' => 'starttime', + 'endtime' => 'endtime', + ], + 'searchFields' => '', + 'iconfile' => 'EXT:templates_aide/Resources/Public/Icons/tx_templatesaide_domain_model_translation.gif' + ], + 'interface' => [ + 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, ', + ], + 'types' => [ + '1' => ['showitem' => ', --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language, sys_language_uid, l10n_parent, l10n_diffsource, --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access, hidden, starttime, endtime'], + ], + 'columns' => [ + 'sys_language_uid' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'special' => 'languages', + 'items' => [ + [ + 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', + -1, + 'flags-multiple' + ] + ], + 'default' => 0, + ], + ], + 'l10n_parent' => [ + 'displayCond' => 'FIELD:sys_language_uid:>:0', + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'default' => 0, + 'items' => [ + ['', 0], + ], + 'foreign_table' => 'tx_templatesaide_domain_model_translation', + 'foreign_table_where' => 'AND {#tx_templatesaide_domain_model_translation}.{#pid}=###CURRENT_PID### AND {#tx_templatesaide_domain_model_translation}.{#sys_language_uid} IN (-1,0)', + ], + ], + 'l10n_diffsource' => [ + 'config' => [ + 'type' => 'passthrough', + ], + ], + 't3ver_label' => [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.versionLabel', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'max' => 255, + ], + ], + 'hidden' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.visible', + 'config' => [ + 'type' => 'check', + 'renderType' => 'checkboxToggle', + 'items' => [ + [ + 0 => '', + 1 => '', + 'invertStateDisplay' => true + ] + ], + ], + ], + 'starttime' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'eval' => 'datetime,int', + 'default' => 0, + 'behaviour' => [ + 'allowLanguageSynchronization' => true + ] + ], + ], + 'endtime' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'eval' => 'datetime,int', + 'default' => 0, + 'range' => [ + 'upper' => mktime(0, 0, 0, 1, 1, 2038) + ], + 'behaviour' => [ + 'allowLanguageSynchronization' => true + ] + ], + ], + + ], +]; diff --git a/Configuration/TypoScript/constants.ts b/Configuration/TypoScript/constants.ts index 365a08c..54a0bb9 100644 --- a/Configuration/TypoScript/constants.ts +++ b/Configuration/TypoScript/constants.ts @@ -14,6 +14,21 @@ plugin.tx_templatesaide_dummy { } } +plugin.tx_templatesaide_translationplugin { + view { + # cat=plugin.tx_templatesaide_translationplugin/file; type=string; label=Path to template root (FE) + templateRootPath = EXT:templates_aide/Resources/Private/Templates/ + # cat=plugin.tx_templatesaide_translationplugin/file; type=string; label=Path to template partials (FE) + partialRootPath = EXT:templates_aide/Resources/Private/Partials/ + # cat=plugin.tx_templatesaide_translationplugin/file; type=string; label=Path to template layouts (FE) + layoutRootPath = EXT:templates_aide/Resources/Private/Layouts/ + } + persistence { + # cat=plugin.tx_templatesaide_translationplugin//a; type=string; label=Default storage PID + storagePid = + } +} + ## EXTENSION BUILDER DEFAULTS END TOKEN - Everything BEFORE this line is overwritten with the defaults of the extension builder - + \ No newline at end of file diff --git a/Configuration/TypoScript/setup.ts b/Configuration/TypoScript/setup.ts index e270b61..c4cc346 100644 --- a/Configuration/TypoScript/setup.ts +++ b/Configuration/TypoScript/setup.ts @@ -1,11 +1,11 @@ plugin.tx_templatesaide_dummy { view { - templateRootPaths.0 = EXT:{extension.shortExtensionKey}/Resources/Private/Templates/ + templateRootPaths.0 = EXT:templates_aide/Resources/Private/Templates/ templateRootPaths.1 = {$plugin.tx_templatesaide_dummy.view.templateRootPath} partialRootPaths.0 = EXT:templates_aide/Resources/Private/Partials/ partialRootPaths.1 = {$plugin.tx_templatesaide_dummy.view.partialRootPath} - layoutRootPaths.0 = EXT:tx_templatesaide/Resources/Private/Layouts/ + layoutRootPaths.0 = EXT:templates_aide/Resources/Private/Layouts/ layoutRootPaths.1 = {$plugin.tx_templatesaide_dummy.view.layoutRootPath} } persistence { @@ -24,6 +24,31 @@ plugin.tx_templatesaide_dummy { } } +plugin.tx_templatesaide_translationplugin { + view { + templateRootPaths.0 = EXT:templates_aide/Resources/Private/Templates/ + templateRootPaths.1 = {$plugin.tx_templatesaide_translationplugin.view.templateRootPath} + partialRootPaths.0 = EXT:templates_aide/Resources/Private/Partials/ + partialRootPaths.1 = {$plugin.tx_templatesaide_translationplugin.view.partialRootPath} + layoutRootPaths.0 = EXT:templates_aide/Resources/Private/Layouts/ + layoutRootPaths.1 = {$plugin.tx_templatesaide_translationplugin.view.layoutRootPath} + } + persistence { + storagePid = {$plugin.tx_templatesaide_translationplugin.persistence.storagePid} + #recursive = 1 + } + features { + #skipDefaultArguments = 1 + # if set to 1, the enable fields are ignored in BE context + ignoreAllEnableFieldsInBe = 0 + # Should be on by default, but can be disabled if all action in the plugin are uncached + requireCHashArgumentForActionArguments = 1 + } + mvc { + #callDefaultActionIfActionCantBeResolved = 1 + } +} + # these classes are only used in auto-generated templates plugin.tx_templatesaide._CSS_DEFAULT_STYLE ( textarea.f3-form-error { diff --git a/Documentation.tmpl/Configuration/Index.rst b/Documentation.tmpl/Configuration/Index.rst index fdaaf1f..39089c1 100644 --- a/Documentation.tmpl/Configuration/Index.rst +++ b/Documentation.tmpl/Configuration/Index.rst @@ -1,5 +1,4 @@ -.. include:: ../Includes.txt - +.. include:: ../Includes.txt .. _configuration: @@ -7,20 +6,17 @@ Configuration ============= -Target group: **Developers, Integrators** - -How is the extension configured? Aim to provide simple instructions detailing -how the extension is configured. Always assume that the user has no prior experience -of using your extension. - -Try and provide a typical use case for your extension and detail each of the -steps required to get the extension running. +How is the extension configured? +Aim to provide simple instructions detailing how the extension is configured. +Always assume that the user has no prior experience of using the extension. +Try and provide a typical use case for your extension +and detail each of the steps required to get the extension running. Typical Example =============== -- Do we need to include a static template? +- Does the integrator need to include a static template? - For example add a code snippet with comments Minimal example of TypoScript: @@ -43,12 +39,12 @@ Minimal example of TypoScript: TypoScript Reference ==================== -When detailing data types or standard TypoScript -features, don't hesitate to cross-link to the TypoScript -Reference. +Possible subsections: Reference of TypoScript options. +The construct below show the recommended structure for TypoScript properties listing and description. -Information about how to use cross-references: -https://docs.typo3.org/typo3cms/HowToDocument/WritingReST/Hyperlinks.html +When detailing data types or standard TypoScript features, +don't hesitate to cross-link to the TypoScript Reference as shown below. + +See :ref:`h2document:how-to-document-hyperlinks` for information about how to use cross-references. See the :file:`Settings.cfg` file for the declaration of cross-linking keys. -You can add more keys besides tsref. diff --git a/ExtensionBuilder.json b/ExtensionBuilder.json index 8cfc1f3..585129c 100644 --- a/ExtensionBuilder.json +++ b/ExtensionBuilder.json @@ -38,6 +38,47 @@ "relations": [] } } + }, + { + "config": { + "position": [ + 398, + 234 + ] + }, + "name": "New Model Object", + "value": { + "actionGroup": { + "_default0_list": false, + "_default1_show": false, + "_default2_new_create": false, + "_default3_edit_update": false, + "_default4_delete": false, + "customActions": [ + "translations" + ] + }, + "name": "Translation", + "objectsettings": { + "addDeletedField": true, + "addHiddenField": true, + "addStarttimeEndtimeFields": true, + "aggregateRoot": false, + "categorizable": false, + "description": "", + "mapToTable": "", + "parentClass": "", + "sorting": false, + "type": "Entity", + "uid": "291507465262" + }, + "propertyGroup": { + "properties": [] + }, + "relationGroup": { + "relations": [] + } + } } ], "properties": { @@ -77,14 +118,25 @@ "description": "", "key": "dummy", "name": "dummy" + }, + { + "actions": { + "controllerActionCombinations": "Translation => translations", + "noncacheableActions": "", + "switchableActions": "" + }, + "description": "", + "key": "translationplugin", + "name": "translation" } ], "vendorName": "Cjel" }, "wires": [], + "storagePath": "\/var\/www\/html\/webroot\/typo3conf\/ext\/", "log": { - "last_modified": "2020-04-26 10:03", - "extension_builder_version": "9.10.2", - "be_user": " (1)" + "last_modified": "2024-02-07 06:12", + "extension_builder_version": "9.10.6", + "be_user": " (68)" } } \ No newline at end of file diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index a2b7adb..93189e7 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -1,25 +1,26 @@ - -
- LFEditor -
+ +
- - + + Dummy - - + + Translation - - + + Default - - + + Disable drag and drop confirmation in page tree - - + + Homepage + + + Subpage - \ No newline at end of file + diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index 549be4e..2fc6539 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -1,17 +1,32 @@ - +
- + Dummy - + + Translation + + dummy - + + + + + translation + + + + + + translation + + - \ No newline at end of file + diff --git a/Resources/Private/TypoScript/Setup/page.ts b/Resources/Private/TypoScript/Setup/page.ts index 618b6d1..efc8b3e 100644 --- a/Resources/Private/TypoScript/Setup/page.ts +++ b/Resources/Private/TypoScript/Setup/page.ts @@ -55,3 +55,19 @@ pageContentelement { no_cache = 1 } } + +pageTranslation = PAGE +pageTranslation { + typeNum = 6001 + 10 = USER_INT + 10 { + userFunc = Cjel\TemplatesAide\UserFunc\Translation->render + } + config { + disableAllHeaderCode = 1 + xhtml_cleaning = 0 + admPanel = 0 + debug = 0 + no_cache = 1 + } +} diff --git a/Resources/Public/Icons/tx_templatesaide_domain_model_translation.gif b/Resources/Public/Icons/tx_templatesaide_domain_model_translation.gif new file mode 100644 index 0000000000000000000000000000000000000000..37ba37b9b3a220018e3a291bf2ee413d0da30ce0 GIT binary patch literal 230 zcmZ?wbh9u|6krfwIKlt|GBPr{y1EAX`lY3%Jv}|Mz+f2|Yy*R1U~nA_UV_1QFaYW; z2AhC~Q2fcl$iN`NpaW6^vXg-|S;5tE3G-Y5<#kHRdp8`B$dNv*cXpRhl~&t>ccvU1 zeHPQ2GIn^1cr6p&73IaoD$=91iK~a{(6rVH&ROOxH+%Y4hNqsq`BO~MkEuZ}q3Mby Zn_ZKDm69U|7Z(ptCx?^igb9ia)&LfwP0|1W literal 0 HcmV?d00001 diff --git a/Resources/Public/Icons/user_plugin_dummy.svg b/Resources/Public/Icons/user_plugin_dummy.svg index 17e1eb1..0cfa220 100644 --- a/Resources/Public/Icons/user_plugin_dummy.svg +++ b/Resources/Public/Icons/user_plugin_dummy.svg @@ -1 +1,4 @@ - \ No newline at end of file + + + + diff --git a/Resources/Public/Icons/user_plugin_translation.svg b/Resources/Public/Icons/user_plugin_translation.svg new file mode 100644 index 0000000..0cfa220 --- /dev/null +++ b/Resources/Public/Icons/user_plugin_translation.svg @@ -0,0 +1,4 @@ + + + + diff --git a/Resources/Public/Icons/user_plugin_translationplugin.svg b/Resources/Public/Icons/user_plugin_translationplugin.svg new file mode 100644 index 0000000..0cfa220 --- /dev/null +++ b/Resources/Public/Icons/user_plugin_translationplugin.svg @@ -0,0 +1,4 @@ + + + + diff --git a/Tests/Unit/Controller/TranslationControllerTest.php b/Tests/Unit/Controller/TranslationControllerTest.php new file mode 100644 index 0000000..7ecd968 --- /dev/null +++ b/Tests/Unit/Controller/TranslationControllerTest.php @@ -0,0 +1,30 @@ + + */ +class TranslationControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase +{ + /** + * @var \Cjel\TemplatesAide\Controller\TranslationController + */ + protected $subject = null; + + protected function setUp() + { + parent::setUp(); + $this->subject = $this->getMockBuilder(\Cjel\TemplatesAide\Controller\TranslationController::class) + ->setMethods(['redirect', 'forward', 'addFlashMessage']) + ->disableOriginalConstructor() + ->getMock(); + } + + protected function tearDown() + { + parent::tearDown(); + } + +} diff --git a/Tests/Unit/Domain/Model/TranslationTest.php b/Tests/Unit/Domain/Model/TranslationTest.php new file mode 100644 index 0000000..19ff916 --- /dev/null +++ b/Tests/Unit/Domain/Model/TranslationTest.php @@ -0,0 +1,34 @@ + + */ +class TranslationTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase +{ + /** + * @var \Cjel\TemplatesAide\Domain\Model\Translation + */ + protected $subject = null; + + protected function setUp() + { + parent::setUp(); + $this->subject = new \Cjel\TemplatesAide\Domain\Model\Translation(); + } + + protected function tearDown() + { + parent::tearDown(); + } + + /** + * @test + */ + public function dummyTestToNotLeaveThisFileEmpty() + { + self::markTestIncomplete(); + } +} diff --git a/ext_localconf.php b/ext_localconf.php index 32e1ddb..55cadcf 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -9,33 +9,57 @@ call_user_func( 'Cjel.TemplatesAide', 'Dummy', [ - 'Dummy' => 'list' + 'Dummy' => 'list', + 'Translation' => 'translations' ], // non-cacheable actions [ - 'Dummy' => '' + 'Dummy' => '', + 'Translation' => '' ] ); - // wizards - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig( - 'mod { - wizards.newContentElement.wizardItems.plugins { - elements { - dummy { - iconIdentifier = templates_aide-plugin-dummy - title = LLL:EXT:templates_aide/Resources/Private/Language/locallang_db.xlf:tx_templates_aide_dummy.name - description = LLL:EXT:templates_aide/Resources/Private/Language/locallang_db.xlf:tx_templates_aide_dummy.description - tt_content_defValues { - CType = list - list_type = templatesaide_dummy + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'Cjel.TemplatesAide', + 'Translationplugin', + [ + 'Translation' => 'translations' + ], + // non-cacheable actions + [ + 'Dummy' => '', + 'Translation' => '' + ] + ); + + // wizards + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig( + 'mod { + wizards.newContentElement.wizardItems.plugins { + elements { + dummy { + iconIdentifier = templates_aide-plugin-dummy + title = LLL:EXT:templates_aide/Resources/Private/Language/locallang_db.xlf:tx_templates_aide_dummy.name + description = LLL:EXT:templates_aide/Resources/Private/Language/locallang_db.xlf:tx_templates_aide_dummy.description + tt_content_defValues { + CType = list + list_type = templatesaide_dummy + } + } + translationplugin { + iconIdentifier = templates_aide-plugin-translationplugin + title = LLL:EXT:templates_aide/Resources/Private/Language/locallang_db.xlf:tx_templates_aide_translationplugin.name + description = LLL:EXT:templates_aide/Resources/Private/Language/locallang_db.xlf:tx_templates_aide_translationplugin.description + tt_content_defValues { + CType = list + list_type = templatesaide_translationplugin + } } } + show = * } - show = * - } - }' - ); + }' + ); $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); $iconRegistry->registerIcon( @@ -44,6 +68,12 @@ call_user_func( ['source' => 'EXT:templates_aide/Resources/Public/Icons/user_plugin_dummy.svg'] ); + $iconRegistry->registerIcon( + 'templates_aide-plugin-translationplugin', + \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + ['source' => 'EXT:templates_aide/Resources/Public/Icons/user_plugin_translationplugin.svg'] + ); + } ); ## EXTENSION BUILDER DEFAULTS END TOKEN - Everything BEFORE this line is overwritten with the defaults of the extension builder @@ -89,4 +119,4 @@ call_user_func( } -); +); \ No newline at end of file diff --git a/ext_tables.php b/ext_tables.php index 2438057..48b4841 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -11,11 +11,20 @@ call_user_func( 'dummy' ); + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( + 'Cjel.TemplatesAide', + 'Translationplugin', + 'translation' + ); + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('templates_aide', 'Configuration/TypoScript', 'Templates Aide'); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_templatesaide_domain_model_dummy', 'EXT:templates_aide/Resources/Private/Language/locallang_csh_tx_templatesaide_domain_model_dummy.xlf'); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_templatesaide_domain_model_dummy'); + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_templatesaide_domain_model_translation', 'EXT:templates_aide/Resources/Private/Language/locallang_csh_tx_templatesaide_domain_model_translation.xlf'); + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_templatesaide_domain_model_translation'); + } ); ## EXTENSION BUILDER DEFAULTS END TOKEN - Everything BEFORE this line is overwritten with the defaults of the extension builder @@ -74,5 +83,4 @@ $GLOBALS['TYPO3_USER_SETTINGS']['showitem'] = str_replace( 'recursiveDelete', 'recursiveDelete,disableDragModal', $GLOBALS['TYPO3_USER_SETTINGS']['showitem'], -); - +); \ No newline at end of file diff --git a/ext_tables.sql b/ext_tables.sql index e69de29..f4c6004 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -0,0 +1,77 @@ +# +# Table structure for table 'tx_templatesaide_domain_model_dummy' +# +CREATE TABLE tx_templatesaide_domain_model_dummy ( + + uid int(11) NOT NULL auto_increment, + pid int(11) DEFAULT '0' NOT NULL, + + tstamp int(11) unsigned DEFAULT '0' NOT NULL, + crdate int(11) unsigned DEFAULT '0' NOT NULL, + cruser_id int(11) unsigned DEFAULT '0' NOT NULL, + deleted smallint(5) unsigned DEFAULT '0' NOT NULL, + hidden smallint(5) unsigned DEFAULT '0' NOT NULL, + starttime int(11) unsigned DEFAULT '0' NOT NULL, + endtime int(11) unsigned DEFAULT '0' NOT NULL, + + t3ver_oid int(11) DEFAULT '0' NOT NULL, + t3ver_id int(11) DEFAULT '0' NOT NULL, + t3ver_wsid int(11) DEFAULT '0' NOT NULL, + t3ver_label varchar(255) DEFAULT '' NOT NULL, + t3ver_state smallint(6) DEFAULT '0' NOT NULL, + t3ver_stage int(11) DEFAULT '0' NOT NULL, + t3ver_count int(11) DEFAULT '0' NOT NULL, + t3ver_tstamp int(11) DEFAULT '0' NOT NULL, + t3ver_move_id int(11) DEFAULT '0' NOT NULL, + + sys_language_uid int(11) DEFAULT '0' NOT NULL, + l10n_parent int(11) DEFAULT '0' NOT NULL, + l10n_diffsource mediumblob, + l10n_state text, + + PRIMARY KEY (uid), + KEY parent (pid), + KEY t3ver_oid (t3ver_oid,t3ver_wsid), + KEY language (l10n_parent,sys_language_uid) + +); + +# +# Table structure for table 'tx_templatesaide_domain_model_translation' +# +CREATE TABLE tx_templatesaide_domain_model_translation ( + + uid int(11) NOT NULL auto_increment, + pid int(11) DEFAULT '0' NOT NULL, + + tstamp int(11) unsigned DEFAULT '0' NOT NULL, + crdate int(11) unsigned DEFAULT '0' NOT NULL, + cruser_id int(11) unsigned DEFAULT '0' NOT NULL, + deleted smallint(5) unsigned DEFAULT '0' NOT NULL, + hidden smallint(5) unsigned DEFAULT '0' NOT NULL, + starttime int(11) unsigned DEFAULT '0' NOT NULL, + endtime int(11) unsigned DEFAULT '0' NOT NULL, + + t3ver_oid int(11) DEFAULT '0' NOT NULL, + t3ver_id int(11) DEFAULT '0' NOT NULL, + t3ver_wsid int(11) DEFAULT '0' NOT NULL, + t3ver_label varchar(255) DEFAULT '' NOT NULL, + t3ver_state smallint(6) DEFAULT '0' NOT NULL, + t3ver_stage int(11) DEFAULT '0' NOT NULL, + t3ver_count int(11) DEFAULT '0' NOT NULL, + t3ver_tstamp int(11) DEFAULT '0' NOT NULL, + t3ver_move_id int(11) DEFAULT '0' NOT NULL, + + sys_language_uid int(11) DEFAULT '0' NOT NULL, + l10n_parent int(11) DEFAULT '0' NOT NULL, + l10n_diffsource mediumblob, + l10n_state text, + + PRIMARY KEY (uid), + KEY parent (pid), + KEY t3ver_oid (t3ver_oid,t3ver_wsid), + KEY language (l10n_parent,sys_language_uid) + +); + +## EXTENSION BUILDER DEFAULTS END TOKEN - Everything BEFORE this line is overwritten with the defaults of the extension builder \ No newline at end of file