[!!!][TASK] Update for TYPO3 11 & 12

This commit is contained in:
Markus Klein 2023-07-06 16:39:52 +02:00
parent 5cfdc7a6cd
commit 873425c433
16 changed files with 81 additions and 109 deletions

View file

@ -16,7 +16,7 @@ jobs:
php-version:
- 7.2
- 7.3
- 7.4
- 8.2
steps:
- name: Checkout
uses: actions/checkout@v2
@ -37,7 +37,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.2
- name: Get Composer Cache Directory
id: composer-cache
@ -55,7 +55,7 @@ jobs:
run: composer install --prefer-dist --no-progress --no-suggest
- name: Check CGL
run: ./vendor/bin/phpcs
run: .Build/vendor/bin/phpcs
check-dependencies:
runs-on: ubuntu-latest
@ -66,7 +66,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.2
- name: Get Composer Cache Directory
id: composer-cache
@ -80,14 +80,11 @@ jobs:
restore-keys: |
${{ runner.os }}-composer-
- name: Keep composer v1 until all dev dependencies are v2 ready
run: sudo composer selfupdate --1
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-plugins
run: composer require maglnet/composer-require-checker
- name: Missing composer requirements
run: ./vendor/bin/composer-require-checker check
run: .Build/vendor/bin/composer-require-checker check
xml-linting:
runs-on: ubuntu-latest
@ -98,7 +95,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.2
- name: Install xmllint
run: sudo apt-get install libxml2-utils
@ -135,8 +132,8 @@ jobs:
strategy:
matrix:
php-version:
- 7.3
- 7.4
- 8.2
steps:
- uses: actions/checkout@v2
@ -157,14 +154,11 @@ jobs:
restore-keys: |
${{ runner.os }}-composer-
- name: Keep composer v1 until all dev dependencies are v2 ready
run: sudo composer selfupdate --1
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: PHPUnit Tests
run: ./vendor/bin/phpunit --testdox
run: .Build/vendor/bin/phpunit --testdox
code-quality:
runs-on: ubuntu-latest
@ -175,7 +169,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.2
- name: Get Composer Cache Directory
id: composer-cache
@ -193,4 +187,4 @@ jobs:
run: composer install --prefer-dist --no-progress --no-suggest
- name: Code Quality (by PHPStan)
run: ./vendor/bin/phpstan analyse
run: .Build/vendor/bin/phpstan analyse

1
.gitignore vendored
View file

@ -1,3 +1,2 @@
/.Build/
/composer.lock
/vendor/

View file

@ -23,6 +23,7 @@ namespace SkillDisplay\SkilldisplayContent\Backend;
* 02110-1301, USA.
*/
use Exception;
use SkillDisplay\PHPToolKit\Api\Skill;
use SkillDisplay\PHPToolKit\Api\SkillSet;
use TYPO3\CMS\Backend\View\PageLayoutView;
@ -31,15 +32,8 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
class Preview implements PageLayoutViewDrawItemHookInterface
{
/**
* @var Skill
*/
protected $skillApi;
/**
* @var SkillSet
*/
private $skillSetApi;
protected Skill $skillApi;
private SkillSet $skillSetApi;
public function __construct(
Skill $skillApi,
@ -78,7 +72,7 @@ class Preview implements PageLayoutViewDrawItemHookInterface
foreach ($skills as $skillId) {
try {
$row['skills'][] = $this->skillApi->getById($skillId);
} catch (\Exception $e) {
} catch (Exception $e) {
$row['skills'][]['error'] = $e->getMessage();
}
}
@ -93,7 +87,7 @@ class Preview implements PageLayoutViewDrawItemHookInterface
foreach ($skillSets as $skillSetId) {
try {
$row['skillSets'][] = $this->skillSetApi->getById($skillSetId);
} catch (\Exception $e) {
} catch (Exception $e) {
$row['skillSets'][]['error'] = $e->getMessage();
}
}

View file

@ -28,15 +28,8 @@ use SkillDisplay\PHPToolKit\Api\Campaigns;
class CampaignsFactory
{
/**
* @var SettingsFactory
*/
private $settingsFactory;
/**
* @var Client
*/
private $client;
private SettingsFactory $settingsFactory;
private Client $client;
public function __construct(
SettingsFactory $settingsFactory,

View file

@ -23,6 +23,7 @@ namespace SkillDisplay\SkilldisplayContent\Frontend\DataProcessing;
* 02110-1301, USA.
*/
use Exception;
use SkillDisplay\PHPToolKit\Api\SkillSet;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
@ -30,10 +31,7 @@ use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface;
class SkillSets implements DataProcessorInterface
{
/**
* @var SkillSet
*/
protected $skillSetApi;
protected SkillSet $skillSetApi;
public function __construct(
SkillSet $skillSetApi
@ -50,7 +48,7 @@ class SkillSets implements DataProcessorInterface
$as = $cObj->stdWrapValue('as', $processorConfiguration, 'skillSets');
$skillSetIds = GeneralUtility::intExplode(
',',
$cObj->stdWrapValue('skillSets', $processorConfiguration, ''),
$cObj->stdWrapValue('skillSets', $processorConfiguration),
true
);
$skillSets = [];
@ -58,7 +56,7 @@ class SkillSets implements DataProcessorInterface
foreach ($skillSetIds as $skillSetId) {
try {
$skillSets[] = $this->skillSetApi->getById($skillSetId);
} catch (\Exception $e) {
} catch (Exception $e) {
continue;
}
}

View file

@ -23,6 +23,7 @@ namespace SkillDisplay\SkilldisplayContent\Frontend\DataProcessing;
* 02110-1301, USA.
*/
use Exception;
use SkillDisplay\PHPToolKit\Api\Skill;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
@ -30,10 +31,7 @@ use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface;
class Skills implements DataProcessorInterface
{
/**
* @var Skill
*/
protected $skillApi;
protected Skill $skillApi;
public function __construct(
Skill $skillApi
@ -50,7 +48,7 @@ class Skills implements DataProcessorInterface
$as = $cObj->stdWrapValue('as', $processorConfiguration, 'skills');
$skillIds = GeneralUtility::intExplode(
',',
$cObj->stdWrapValue('skills', $processorConfiguration, ''),
$cObj->stdWrapValue('skills', $processorConfiguration),
true
);
$skills = [];
@ -58,7 +56,7 @@ class Skills implements DataProcessorInterface
foreach ($skillIds as $skillId) {
try {
$skills[] = $this->skillApi->getById($skillId);
} catch (\Exception $e) {
} catch (Exception $e) {
continue;
}
}

View file

@ -23,6 +23,7 @@ namespace SkillDisplay\SkilldisplayContent;
* 02110-1301, USA.
*/
use RuntimeException;
use SkillDisplay\PHPToolKit\Configuration\Settings;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Core\Site\Entity\Site;
@ -30,10 +31,7 @@ use TYPO3\CMS\Core\Site\SiteFinder;
class SettingsFactory
{
/**
* @var SiteFinder
*/
private $siteFinder;
private SiteFinder $siteFinder;
public function __construct(
SiteFinder $siteFinder
@ -45,7 +43,7 @@ class SettingsFactory
{
$site = $this->getRequest()->getAttribute('site');
if ($site === null) {
throw new \Exception('Could not determine current site.', 1599721652);
throw new RuntimeException('Could not determine current site.', 1599721652);
}
return $this->createFromSite($site);

View file

@ -9,10 +9,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
class TcaEnhancer
{
/**
* @var CampaignsFactory
*/
private $campaignsFactory;
private CampaignsFactory $campaignsFactory;
public function __construct(
CampaignsFactory $campaignsFactory

View file

@ -23,6 +23,8 @@ namespace SkillDisplay\SkilldisplayContent\ViewHelpers;
* 02110-1301, USA.
*/
use Closure;
use Exception;
use SkillDisplay\PHPToolKit\Verification\Link;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
@ -44,10 +46,14 @@ abstract class VerificationViewHelper extends AbstractViewHelper
public static function renderStatic(
array $arguments,
\Closure $renderChildrenClosure,
Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
) {
try {
static::validateIds($arguments);
} catch (Exception $e) {
return '';
}
return static::verificationHtml($arguments);
}
@ -55,22 +61,24 @@ abstract class VerificationViewHelper extends AbstractViewHelper
abstract protected static function verificationHtml(array $arguments): string;
/**
* @param array $arguments
* @return void
* @throws Exception
*/
protected static function validateIds(array $arguments)
protected static function validateIds(array $arguments): void
{
if (
isset($arguments['skill']) && $arguments['skill'] !== ''
&& isset($arguments['skillSet']) && $arguments['skillSet'] !== ''
) {
throw new \Exception('Can only handle skill or skillSet not both.', 1600775604);
throw new Exception('Can only handle skill or skillSet not both.', 1600775604);
}
if (
(isset($arguments['skill']) === false || $arguments['skill'] === '')
&& (isset($arguments['skillSet']) === false || $arguments['skillSet'] === '')
) {
throw new \Exception('Either needs skill or skillSet, none given.', 1600775604);
throw new Exception('Either needs skill or skillSet, none given.', 1600775604);
}
}

View file

@ -1,9 +1,7 @@
<?php
(function (string $extensionKey, string $tableName) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
$extensionKey,
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'skilldisplay_content',
'Configuration/TypoScript/',
'SkillDisplay'
);
})('skilldisplay_content', 'sys_template');
);

View file

@ -1,9 +1,9 @@
<?php
(function (string $extensionKey, string $tableName) {
$languagePath = 'LLL:EXT:' . $extensionKey . '/Resources/Private/Language/locallang_tca.xlf:' . $tableName . '.';
(function (string $extensionKey) {
$languagePath = 'LLL:EXT:' . $extensionKey . '/Resources/Private/Language/locallang_tca.xlf:tt_content.';
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA'][$tableName], [
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['tt_content'], [
'columns' => [
'CType' => [
'config' => [
@ -13,7 +13,7 @@
],
],
'skilldisplay_skills' => [
'exclude' => 1,
'exclude' => true,
'label' => $languagePath . 'skilldisplay_skills',
'description' => $languagePath . 'skilldisplay_skills.description',
'config' => [
@ -23,7 +23,7 @@
],
],
'skilldisplay_skillset' => [
'exclude' => 1,
'exclude' => true,
'label' => $languagePath . 'skilldisplay_skillset',
'description' => $languagePath . 'skilldisplay_skillset.description',
'config' => [
@ -33,17 +33,16 @@
],
],
'skilldisplay_campaign' => [
'exclude' => 1,
'exclude' => true,
'label' => $languagePath . 'skilldisplay_campaign',
'description' => $languagePath . 'skilldisplay_campaign.description',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'itemsProcFunc' => \SkillDisplay\SkilldisplayContent\TcaEnhancer::class
. '->' . 'getCampaignsForTCA',
'itemsProcFunc' => \SkillDisplay\SkilldisplayContent\TcaEnhancer::class . '->' . 'getCampaignsForTCA',
'items' => []
]
],
],
]);
})('skilldisplay_content', 'tt_content');
})('skilldisplay_content');

View file

@ -1,4 +1,4 @@
tt_content.skilldisplay_skills = < lib.contentElement
tt_content.skilldisplay_skills =< lib.contentElement
tt_content.skilldisplay_skills {
templateName = SkillDisplaySkills
@ -10,7 +10,7 @@ tt_content.skilldisplay_skills {
}
}
tt_content.skilldisplay_skillset = < lib.contentElement
tt_content.skilldisplay_skillset =< lib.contentElement
tt_content.skilldisplay_skillset {
templateName = SkillDisplaySkillSet
@ -22,8 +22,3 @@ tt_content.skilldisplay_skillset {
}
}
page {
includeCSS {
skilldisplay = EXT:skilldisplay_content/Resources/Public/Css/Styles.css
}
}

View file

@ -21,8 +21,7 @@ Right now it provides the following features:
Installation
============
The extension can be installed by downloading recent version from GitHub and adding
it inside `typo3conf/` folder.
Install the extension via Extension Manager or composer.
Add static TypoScript once installed and activated via Extension Manager.
The TypoScript contains the rendering definition for provided content elements.
@ -47,6 +46,11 @@ Or copy the files from `/Resources/Private/Templates/ContentElements/` to your e
Configuration
=============
You may include default CSS for the templates in your TypoScript::
page.includeCSS.skilldisplay = EXT:skilldisplay_content/Resources/Public/Css/Styles.css
Site configuration is extended, where options like API Key can be provided.
Also TypoScript and TSconfig is added to provide wizard entries for new content elements, as well as rendering.

View file

@ -26,40 +26,36 @@
}
},
"require": {
"php": "7.2.* || 7.3.* || 7.4.*",
"typo3/cms-core": "^10.4",
"skilldisplay/phptoolkit": "^1.2.3",
"typo3/cms-backend": "^10.4",
"typo3/cms-frontend": "^10.4",
"typo3fluid/fluid": "^2.6",
"guzzlehttp/guzzle": "^6.5"
"php": "^7.4 || ^8.1 || ^8.2",
"skilldisplay/phptoolkit": "^2.0",
"typo3/cms-backend": "^11.5 || ^12.4",
"typo3/cms-frontend": "^11.5 || ^12.4"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5",
"phpstan/phpstan": "^0.12.18",
"phpstan/phpstan-phpunit": "*",
"phpstan/extension-installer": "^1.0",
"maglnet/composer-require-checker": "^2.1",
"saschaegerer/phpstan-typo3": "^0.13.1",
"typo3/testing-framework": "^6.4",
"typo3/testing-framework": "^7",
"phpspec/prophecy-phpunit": "^2",
"jangregor/phpstan-prophecy": "^0.8.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"TYPO3\\TestingFramework\\Composer\\ExtensionTestEnvironment::prepare"
]
},
"extra": {
"typo3/cms": {
"cms-package-dir": "{$vendor-dir}/typo3/cms",
"extension-key": "skilldisplay_content",
"web-dir": ".Build/web"
},
"branch-alias": {
"dev-main": "2.0.x-dev"
"dev-main": "3.x-dev"
}
},
"config": {
"vendor-dir": ".Build/vendor",
"allow-plugins": {
"typo3/cms-composer-installers": true,
"typo3/class-alias-loader": true,
"phpstan/extension-installer": true
}
}
}

View file

@ -11,10 +11,10 @@ $EM_CONF[$_EXTKEY] = [
'author' => 'Daniel Siepmann',
'author_email' => 'coding@daniel-siepmann.de',
'author_company' => '',
'version' => '2.0.3',
'version' => '3.0.0',
'constraints' => [
'depends' => [
'typo3' => '10.4.0-10.4.99',
'typo3' => '11.5.0-12.4.99',
],
'conflicts' => [],
'suggests' => [],

View file

@ -22,6 +22,7 @@
);
}
// todo v11?
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem'][$extKey] =
\SkillDisplay\SkilldisplayContent\Backend\Preview::class;
})('skilldisplay_content');