From fd14ad8e4b0b312022101b145d25e3753f08c507 Mon Sep 17 00:00:00 2001 From: Daniel Goerz Date: Mon, 2 Apr 2018 11:24:03 +0200 Subject: [PATCH 01/11] [TASK] Update ext_emconf --- ext_emconf.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/ext_emconf.php b/ext_emconf.php index cdc95d0..5d571f4 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -5,26 +5,17 @@ 'description' => 'An example extension showing the opportunities of th JSON view.', 'category' => 'plugin', 'shy' => false, - 'version' => '1.1.1', - 'dependencies' => '', - 'conflicts' => '', - 'priority' => '', - 'loadOrder' => '', - 'module' => '', + 'version' => '2.0.0', 'state' => 'stable', 'uploadfolder' => 0, 'createDirs' => '', - 'modify_tables' => '', 'clearcacheonload' => true, - 'lockType' => '', 'author' => 'Daniel Goerz', 'author_email' => 'ervaude@gmail.com', 'author_company' => 'Lightwerk GmbH', - 'CGLcompliance' => null, - 'CGLcompliance_note' => null, 'constraints' => [ 'depends' => [ - 'typo3' => '7.5.0-7.99.99' + 'typo3' => '7.5.0-9.99.99' ], 'conflicts' => [], 'suggests' => [] From 15db21f0f2e8f3ca6c5049b4822d5669bd6bbe8e Mon Sep 17 00:00:00 2001 From: Daniel Goerz Date: Mon, 2 Apr 2018 11:38:39 +0200 Subject: [PATCH 02/11] [TASK] Move Extension icon to Resources/Public/Icons --- .../Public/Icons/Extension.gif | Bin 1 file changed, 0 insertions(+), 0 deletions(-) rename ext_icon.gif => Resources/Public/Icons/Extension.gif (100%) diff --git a/ext_icon.gif b/Resources/Public/Icons/Extension.gif similarity index 100% rename from ext_icon.gif rename to Resources/Public/Icons/Extension.gif From 6606d14dcf4f3a8ebc870c02a731ff31a2f540f3 Mon Sep 17 00:00:00 2001 From: Daniel Goerz Date: Mon, 2 Apr 2018 11:39:05 +0200 Subject: [PATCH 03/11] [TASK] Adapt TCA to 8LTS and higher --- .../TCA/tx_jsonexample_domain_model_post.php | 57 +++++++++---------- .../TCA/tx_jsonexample_domain_model_tag.php | 49 +++++++--------- 2 files changed, 48 insertions(+), 58 deletions(-) diff --git a/Configuration/TCA/tx_jsonexample_domain_model_post.php b/Configuration/TCA/tx_jsonexample_domain_model_post.php index c05443a..1d53e53 100644 --- a/Configuration/TCA/tx_jsonexample_domain_model_post.php +++ b/Configuration/TCA/tx_jsonexample_domain_model_post.php @@ -1,6 +1,6 @@ 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', - 'dividers2tabs' => true, - 'delete' => 'deleted', 'enablecolumns' => [ 'disabled' => 'hidden', @@ -24,7 +22,9 @@ 'showRecordFieldList' => 'hidden, title, post_text, tags', ], 'types' => [ - '1' => ['showitem' => 'hidden;;1, title, post_text, tags, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => [ + 'showitem' => 'hidden;;1, title, post_text, tags, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime' + ], ], 'palettes' => [ '1' => ['showitem' => ''], @@ -39,36 +39,31 @@ ], ], 'starttime' => [ - 'exclude' => 1, - 'l10n_mode' => 'mergeIfNotBlank', - 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime', - 'config' => [ - 'type' => 'input', - 'size' => 13, - 'max' => 20, - 'eval' => 'datetime', - 'checkbox' => 0, - 'default' => 0, - 'range' => [ - 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) - ], + 'exclude' => true, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.starttime', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'eval' => 'datetime,int', + 'default' => 0 ], + 'l10n_mode' => 'exclude', + 'l10n_display' => 'defaultAsReadonly' ], - 'endtime' => [ - 'exclude' => 1, - 'l10n_mode' => 'mergeIfNotBlank', - 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime', - 'config' => [ - 'type' => 'input', - 'size' => 13, - 'max' => 20, - 'eval' => 'datetime', - 'checkbox' => 0, - 'default' => 0, - 'range' => [ - 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) - ], + 'endtime' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:lang/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) + ] ], + 'l10n_mode' => 'exclude', + 'l10n_display' => 'defaultAsReadonly' ], 'title' => [ diff --git a/Configuration/TCA/tx_jsonexample_domain_model_tag.php b/Configuration/TCA/tx_jsonexample_domain_model_tag.php index c347e3a..9f619c9 100644 --- a/Configuration/TCA/tx_jsonexample_domain_model_tag.php +++ b/Configuration/TCA/tx_jsonexample_domain_model_tag.php @@ -39,36 +39,31 @@ ], ], 'starttime' => [ - 'exclude' => 1, - 'l10n_mode' => 'mergeIfNotBlank', - 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime', - 'config' => [ - 'type' => 'input', - 'size' => 13, - 'max' => 20, - 'eval' => 'datetime', - 'checkbox' => 0, - 'default' => 0, - 'range' => [ - 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) - ], + 'exclude' => true, + 'label' => 'LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.starttime', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'eval' => 'datetime,int', + 'default' => 0 ], + 'l10n_mode' => 'exclude', + 'l10n_display' => 'defaultAsReadonly' ], - 'endtime' => [ - 'exclude' => 1, - 'l10n_mode' => 'mergeIfNotBlank', - 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime', - 'config' => [ - 'type' => 'input', - 'size' => 13, - 'max' => 20, - 'eval' => 'datetime', - 'checkbox' => 0, - 'default' => 0, - 'range' => [ - 'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y')) - ], + 'endtime' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:lang/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) + ] ], + 'l10n_mode' => 'exclude', + 'l10n_display' => 'defaultAsReadonly' ], 'title' => [ From 1aea1e9d80776ed7c1a8b7a65db437229f4e7498 Mon Sep 17 00:00:00 2001 From: Daniel Goerz Date: Mon, 2 Apr 2018 11:40:10 +0200 Subject: [PATCH 04/11] [TASK] Drop support for TYPO3 7LTS --- composer.json | 2 +- ext_emconf.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index de992ca..50f1fc3 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "GPL-2.0+" ], "require": { - "typo3/cms-core": ">=7.6.0,<7.6.99" + "typo3/cms-core": ">=8.6.0,<9.2.0" }, "autoload": { "psr-4": { diff --git a/ext_emconf.php b/ext_emconf.php index 5d571f4..a7ba4cd 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -15,7 +15,7 @@ 'author_company' => 'Lightwerk GmbH', 'constraints' => [ 'depends' => [ - 'typo3' => '7.5.0-9.99.99' + 'typo3' => '8.6.0-9.99.99' ], 'conflicts' => [], 'suggests' => [] From 78d29aa01ce3da8f81ba825aefb914f85563a778 Mon Sep 17 00:00:00 2001 From: Daniel Goerz Date: Mon, 2 Apr 2018 11:40:40 +0200 Subject: [PATCH 05/11] [TASK] Rename setup.txt to setup.typoscript --- Configuration/TypoScript/{setup.txt => setup.typoscript} | 2 ++ 1 file changed, 2 insertions(+) rename Configuration/TypoScript/{setup.txt => setup.typoscript} (77%) diff --git a/Configuration/TypoScript/setup.txt b/Configuration/TypoScript/setup.typoscript similarity index 77% rename from Configuration/TypoScript/setup.txt rename to Configuration/TypoScript/setup.typoscript index d94758c..da33408 100644 --- a/Configuration/TypoScript/setup.txt +++ b/Configuration/TypoScript/setup.typoscript @@ -1,3 +1,4 @@ +plugin.tx_jsonexample.features.requireCHashArgumentForActionArguments = 0 api_tag = PAGE api_tag { @@ -6,6 +7,7 @@ api_tag { debug = 0 no_cache = 1 } + typeNum = 1452982642 10 < tt_content.list.20.jsonexample_json_tag } From e20df889716bed0710eeda7d7636efa48f408e4c Mon Sep 17 00:00:00 2001 From: Daniel Goerz Date: Mon, 2 Apr 2018 11:41:14 +0200 Subject: [PATCH 06/11] [TASK] remove ext_tables.php in favour of TCA/Overides --- .../TCA/Overrides/sys_template.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) rename ext_tables.php => Configuration/TCA/Overrides/sys_template.php (57%) diff --git a/ext_tables.php b/Configuration/TCA/Overrides/sys_template.php similarity index 57% rename from ext_tables.php rename to Configuration/TCA/Overrides/sys_template.php index 7267e20..40275ad 100644 --- a/ext_tables.php +++ b/Configuration/TCA/Overrides/sys_template.php @@ -1,4 +1,8 @@ Date: Mon, 2 Apr 2018 11:42:11 +0200 Subject: [PATCH 07/11] [TASK] Cleanup annotations in AbstractApiController --- Classes/Controller/AbstractApiController.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Classes/Controller/AbstractApiController.php b/Classes/Controller/AbstractApiController.php index 3299a65..ef15ae9 100644 --- a/Classes/Controller/AbstractApiController.php +++ b/Classes/Controller/AbstractApiController.php @@ -47,6 +47,8 @@ abstract class AbstractApiController extends ActionController * Resolves and checks the current action method name * * @return string Method name of the current action + * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException + * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException */ protected function resolveActionMethodName() { @@ -54,20 +56,23 @@ protected function resolveActionMethodName() case 'HEAD': case 'GET': $actionName = ($this->request->hasArgument($this->resourceArgumentName)) ? 'show' : 'list'; - break; + return $actionName . 'Action'; + + // Not supported in Example case 'POST': case 'PUT': case 'DELETE': default: $this->throwStatus(400, null, 'Bad Request.'); } - return $actionName . 'Action'; + $this->throwStatus(400, null, 'Bad Request.'); } /** * Maps arguments delivered by the request object to the local controller arguments. * - * @return void + * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException + * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException */ protected function mapRequestArgumentsToControllerArguments() { @@ -80,8 +85,6 @@ protected function mapRequestArgumentsToControllerArguments() /** * Action List - * - * @return void */ public function listAction() { From 602987e824afadc0695e79d6ca1004dc920da6f2 Mon Sep 17 00:00:00 2001 From: Daniel Goerz Date: Mon, 2 Apr 2018 11:42:44 +0200 Subject: [PATCH 08/11] [TASK] Use inject methods instead of annotation --- Classes/Controller/PostController.php | 11 +++++++++-- Classes/Controller/TagController.php | 7 ++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Classes/Controller/PostController.php b/Classes/Controller/PostController.php index 5732b53..5511435 100644 --- a/Classes/Controller/PostController.php +++ b/Classes/Controller/PostController.php @@ -14,6 +14,7 @@ * The TYPO3 project - inspiring people to share! */ use DanielGoerz\JsonExample\Domain\Model\Post; +use DanielGoerz\JsonExample\Domain\Repository\PostRepository; /** * Class TagController @@ -29,15 +30,21 @@ class PostController extends AbstractApiController /** * @var \DanielGoerz\JsonExample\Domain\Repository\PostRepository - * @inject */ protected $resourceRepository; + /** + * @param PostRepository $resourceRepository + */ + public function injectResourceRepository(PostRepository $resourceRepository) + { + $this->resourceRepository = $resourceRepository; + } + /** * Action Show * * @param Post $post - * @return void */ public function showAction(Post $post) { diff --git a/Classes/Controller/TagController.php b/Classes/Controller/TagController.php index e373122..4aac9e5 100644 --- a/Classes/Controller/TagController.php +++ b/Classes/Controller/TagController.php @@ -14,6 +14,7 @@ * The TYPO3 project - inspiring people to share! */ use DanielGoerz\JsonExample\Domain\Model\Tag; +use DanielGoerz\JsonExample\Domain\Repository\TagRepository; /** * Class TagController @@ -29,10 +30,14 @@ class TagController extends AbstractApiController /** * @var \DanielGoerz\JsonExample\Domain\Repository\TagRepository - * @inject */ protected $resourceRepository; + public function injectResourceRepository(TagRepository $resourceRepository) + { + $this->resourceRepository = $resourceRepository; + } + /** * Action Show * From 6db9aecddf543f327b1089e0f837502f59260497 Mon Sep 17 00:00:00 2001 From: Daniel Goerz Date: Mon, 2 Apr 2018 11:43:09 +0200 Subject: [PATCH 09/11] [TASK] Streamline check for TYPO3_MODE --- ext_localconf.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ext_localconf.php b/ext_localconf.php index faaca70..c77cc23 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,6 +1,5 @@ Date: Mon, 2 Apr 2018 11:52:13 +0200 Subject: [PATCH 10/11] [BUGFIX] Use correct icon in TCA and apply compatibility changes --- .../TCA/tx_jsonexample_domain_model_post.php | 11 ++++++----- Configuration/TCA/tx_jsonexample_domain_model_tag.php | 7 +++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Configuration/TCA/tx_jsonexample_domain_model_post.php b/Configuration/TCA/tx_jsonexample_domain_model_post.php index 1d53e53..b37e352 100644 --- a/Configuration/TCA/tx_jsonexample_domain_model_post.php +++ b/Configuration/TCA/tx_jsonexample_domain_model_post.php @@ -16,14 +16,15 @@ 'starttime' => 'starttime', 'endtime' => 'endtime', ], - 'iconfile' => 'EXT:json_example/ext_icon.gif' + 'iconfile' => 'EXT:json_example/Resources/Public/Icons/Extension.gif' ], 'interface' => [ 'showRecordFieldList' => 'hidden, title, post_text, tags', ], 'types' => [ '1' => [ - 'showitem' => 'hidden;;1, title, post_text, tags, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime' + 'showitem' => 'hidden, title, post_text, tags,' + . '--div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime' ], ], 'palettes' => [ @@ -68,7 +69,7 @@ 'title' => [ 'exclude' => 1, - 'label' => 'title', + 'label' => 'Title', 'config' => [ 'type' => 'input', 'size' => 30, @@ -79,8 +80,8 @@ 'exclude' => 1, 'label' => 'Text', 'config' => [ - 'type' => 'input', - 'size' => 30, + 'type' => 'text', + 'rows' => 6, 'eval' => 'trim' ], ], diff --git a/Configuration/TCA/tx_jsonexample_domain_model_tag.php b/Configuration/TCA/tx_jsonexample_domain_model_tag.php index 9f619c9..4b64a02 100644 --- a/Configuration/TCA/tx_jsonexample_domain_model_tag.php +++ b/Configuration/TCA/tx_jsonexample_domain_model_tag.php @@ -10,7 +10,6 @@ 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', - 'dividers2tabs' => true, 'delete' => 'deleted', 'enablecolumns' => [ @@ -18,13 +17,13 @@ 'starttime' => 'starttime', 'endtime' => 'endtime', ], - 'iconfile' => 'EXT:json_example/ext_icon.gif' + 'iconfile' => 'EXT:json_example/Resources/Public/Icons/Extension.gif' ], 'interface' => [ 'showRecordFieldList' => 'hidden, title', ], 'types' => [ - '1' => ['showitem' => 'hidden;;1, title, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => ['showitem' => 'hidden, title, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime'], ], 'palettes' => [ '1' => ['showitem' => ''], @@ -68,7 +67,7 @@ 'title' => [ 'exclude' => 1, - 'label' => 'title', + 'label' => 'Title', 'config' => [ 'type' => 'input', 'size' => 30, From 051b313d36304622bdb386b29231d98fae473dad Mon Sep 17 00:00:00 2001 From: Daniel Goerz Date: Mon, 2 Apr 2018 12:00:17 +0200 Subject: [PATCH 11/11] [TASK] Adapt Readme.md to new requirements --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 7f02a22..679f7f8 100644 --- a/Readme.md +++ b/Readme.md @@ -3,7 +3,7 @@ json_example is an example extension that provides everything to use the JSON view shipped with the TYPO3 core. ## System Requirements -The extension was developed using TYPO3 7 LTS. +The extension requires TYPO3 8LTS, 9.0 or 9.1. ## Installation Install the extension and include the static TypoScript. You may want to add some records of type tag and post in the backend to provide actual output.