Compare commits

...

9 commits

Author SHA1 Message Date
Markus Klein f0572b02af [BUGFIX] Allow multiple Skill(Set) uids in CE 2023-07-06 18:56:54 +02:00
Markus Klein be3e3b0362 [BUGFIX] Ignore missing API key exception 2023-07-06 18:34:18 +02:00
Markus Klein 9418000e25 [TASK] Correct path to phpunit bootstrap 2023-07-06 17:55:05 +02:00
Markus Klein df2e7aeb77 [TASK] Remove dependency checker 2023-07-06 17:33:00 +02:00
Markus Klein a96923c6b1 [TASK] Remove dependency checker 2023-07-06 17:08:41 +02:00
Markus Klein f8e2945b77 [TASK] Fix vendor folder path 2023-07-06 16:54:49 +02:00
Markus Klein a6afd0c24c [TASK] CGL fix 2023-07-06 16:53:14 +02:00
Markus Klein 0cf0007e1a [TASK] Remove php-liniting for PHP < 7.4 2023-07-06 16:51:56 +02:00
Markus Klein 873425c433 [!!!][TASK] Update for TYPO3 11 & 12 2023-07-06 16:39:52 +02:00
17 changed files with 89 additions and 140 deletions

View file

@ -14,9 +14,8 @@ jobs:
strategy:
matrix:
php-version:
- 7.2
- 7.3
- 7.4
- 8.2
steps:
- name: Checkout
uses: actions/checkout@v2
@ -37,7 +36,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,39 +54,7 @@ jobs:
run: composer install --prefer-dist --no-progress --no-suggest
- name: Check CGL
run: ./vendor/bin/phpcs
check-dependencies:
runs-on: ubuntu-latest
needs: [check-composer]
steps:
- uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
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
- name: Missing composer requirements
run: ./vendor/bin/composer-require-checker check
run: .Build/vendor/bin/phpcs
xml-linting:
runs-on: ubuntu-latest
@ -98,7 +65,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
@ -119,7 +86,7 @@ jobs:
run: composer install --prefer-dist --no-progress --no-suggest
- name: PHPCodeSniffer configuration file
run: xmllint --schema vendor/squizlabs/php_codesniffer/phpcs.xsd --noout phpcs.xml.dist
run: xmllint --schema .Build/vendor/squizlabs/php_codesniffer/phpcs.xsd --noout phpcs.xml.dist
- name: Fetch schema for xliff
run: wget https://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd --output-document=.Build/xliff-core-1.2-strict.xsd
@ -130,13 +97,12 @@ jobs:
tests:
runs-on: ubuntu-latest
needs:
- check-dependencies
- xml-linting
strategy:
matrix:
php-version:
- 7.3
- 7.4
- 8.2
steps:
- uses: actions/checkout@v2
@ -157,25 +123,21 @@ 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
needs: [check-dependencies]
steps:
- uses: actions/checkout@v2
- 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 +155,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, ''),
(string)$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, ''),
(string)$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
@ -28,7 +25,15 @@ class TcaEnhancer
$pid = $this->resolvePid($params['row']);
if ($pid > 0) {
$campaigns = $this->campaignsFactory->createFromPageUid($pid)->getForUser();
try {
$campaigns = $this->campaignsFactory->createFromPageUid($pid)->getForUser();
} catch (\InvalidArgumentException $e) {
// ignore missing API key exception
if ($e->getCode() !== 1688660942) {
throw $e;
}
return;
}
/** @var Campaign $campaign */
foreach ($campaigns as $campaign) {
$params['items'][] = [

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
) {
static::validateIds($arguments);
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,
'Configuration/TypoScript/',
'SkillDisplay'
);
})('skilldisplay_content', 'sys_template');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'skilldisplay_content',
'Configuration/TypoScript/',
'SkillDisplay'
);

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,17 +23,17 @@
],
],
'skilldisplay_skillset' => [
'exclude' => 1,
'exclude' => true,
'label' => $languagePath . 'skilldisplay_skillset',
'description' => $languagePath . 'skilldisplay_skillset.description',
'config' => [
'type' => 'input',
'eval' => 'int,required',
'eval' => 'required',
'size' => 10,
],
],
'skilldisplay_campaign' => [
'exclude' => 1,
'exclude' => true,
'label' => $languagePath . 'skilldisplay_campaign',
'description' => $languagePath . 'skilldisplay_campaign.description',
'config' => [
@ -46,4 +46,4 @@
],
],
]);
})('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.1",
"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');

View file

@ -4,7 +4,7 @@
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php"
bootstrap=".Build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertWarningsToExceptions="true"