Skip to content

Commit

Permalink
Merge pull request #5 from ervaude/compat-9
Browse files Browse the repository at this point in the history
Compat 9
  • Loading branch information
ervaude authored Apr 2, 2018
2 parents 8c7ef9d + 051b313 commit f8ee9af
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 90 deletions.
13 changes: 8 additions & 5 deletions Classes/Controller/AbstractApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,32 @@ 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()
{
switch ($this->request->getMethod()) {
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()
{
Expand All @@ -80,8 +85,6 @@ protected function mapRequestArgumentsToControllerArguments()

/**
* Action List
*
* @return void
*/
public function listAction()
{
Expand Down
11 changes: 9 additions & 2 deletions Classes/Controller/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
{
Expand Down
7 changes: 6 additions & 1 deletion Classes/Controller/TagController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php
defined('TYPO3_MODE') or die();

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'JSON Example');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'json_example',
'Configuration/TypoScript',
'JSON Example'
);
66 changes: 31 additions & 35 deletions Configuration/TCA/tx_jsonexample_domain_model_post.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
if (!defined('TYPO3_MODE')) {
die ('Access denied.');
die('Access denied.');
}

return [
Expand All @@ -10,21 +10,22 @@
'tstamp' => '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' => ''],
Expand All @@ -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,
Expand All @@ -84,8 +80,8 @@
'exclude' => 1,
'label' => 'Text',
'config' => [
'type' => 'input',
'size' => 30,
'type' => 'text',
'rows' => 6,
'eval' => 'trim'
],
],
Expand Down
56 changes: 25 additions & 31 deletions Configuration/TCA/tx_jsonexample_domain_model_tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,20 @@
'tstamp' => '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',
],
'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' => ''],
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
plugin.tx_jsonexample.features.requireCHashArgumentForActionArguments = 0

api_tag = PAGE
api_tag {
Expand All @@ -6,6 +7,7 @@ api_tag {
debug = 0
no_cache = 1
}

typeNum = 1452982642
10 < tt_content.list.20.jsonexample_json_tag
}
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
13 changes: 2 additions & 11 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => '[email protected]',
'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' => []
Expand Down
3 changes: 1 addition & 2 deletions ext_localconf.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

defined('TYPO3_MODE') || exit('Access denied.');
defined('TYPO3_MODE') or die();

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'DanielGoerz.' . $_EXTKEY,
Expand Down

0 comments on commit f8ee9af

Please sign in to comment.