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() { 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 * 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 @@ 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', - 'dividers2tabs' => true, - 'delete' => 'deleted', 'enablecolumns' => [ 'disabled' => 'hidden', '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'], + '1' => [ + 'showitem' => 'hidden, title, post_text, tags,' + . '--div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, starttime, endtime' + ], ], 'palettes' => [ '1' => ['showitem' => ''], @@ -39,41 +40,36 @@ ], ], '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' => [ 'exclude' => 1, - 'label' => 'title', + 'label' => 'Title', 'config' => [ 'type' => 'input', 'size' => 30, @@ -84,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 c347e3a..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' => ''], @@ -39,41 +38,36 @@ ], ], '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' => [ 'exclude' => 1, - 'label' => 'title', + 'label' => 'Title', 'config' => [ 'type' => 'input', 'size' => 30, 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 } 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. 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 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 cdc95d0..a7ba4cd 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' => '8.6.0-9.99.99' ], 'conflicts' => [], 'suggests' => [] 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 @@