diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dbda2ae..d7cf212 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/.gitignore b/.gitignore index 51313d0..e951a59 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ /.Build/ /composer.lock -/vendor/ diff --git a/Classes/Backend/Preview.php b/Classes/Backend/Preview.php index 2e5a9b0..f13b92e 100644 --- a/Classes/Backend/Preview.php +++ b/Classes/Backend/Preview.php @@ -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(); } } diff --git a/Classes/CampaignsFactory.php b/Classes/CampaignsFactory.php index 32fef46..5f1da77 100644 --- a/Classes/CampaignsFactory.php +++ b/Classes/CampaignsFactory.php @@ -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, diff --git a/Classes/Frontend/DataProcessing/SkillSets.php b/Classes/Frontend/DataProcessing/SkillSets.php index 34439d1..d8255fb 100644 --- a/Classes/Frontend/DataProcessing/SkillSets.php +++ b/Classes/Frontend/DataProcessing/SkillSets.php @@ -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; } } diff --git a/Classes/Frontend/DataProcessing/Skills.php b/Classes/Frontend/DataProcessing/Skills.php index 6cdfbfe..7ddbc31 100644 --- a/Classes/Frontend/DataProcessing/Skills.php +++ b/Classes/Frontend/DataProcessing/Skills.php @@ -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; } } diff --git a/Classes/SettingsFactory.php b/Classes/SettingsFactory.php index 32c4fad..0bbc0ed 100644 --- a/Classes/SettingsFactory.php +++ b/Classes/SettingsFactory.php @@ -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); diff --git a/Classes/TcaEnhancer.php b/Classes/TcaEnhancer.php index 0b37441..8003cdc 100644 --- a/Classes/TcaEnhancer.php +++ b/Classes/TcaEnhancer.php @@ -9,10 +9,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility; class TcaEnhancer { - /** - * @var CampaignsFactory - */ - private $campaignsFactory; + private CampaignsFactory $campaignsFactory; public function __construct( CampaignsFactory $campaignsFactory diff --git a/Classes/ViewHelpers/VerificationViewHelper.php b/Classes/ViewHelpers/VerificationViewHelper.php index 467654e..46f1778 100644 --- a/Classes/ViewHelpers/VerificationViewHelper.php +++ b/Classes/ViewHelpers/VerificationViewHelper.php @@ -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); } } diff --git a/Configuration/TCA/Overrides/sys_template.php b/Configuration/TCA/Overrides/sys_template.php index 1a12775..da93e2e 100644 --- a/Configuration/TCA/Overrides/sys_template.php +++ b/Configuration/TCA/Overrides/sys_template.php @@ -1,9 +1,7 @@ [ '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'); diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript index 868511a..9e94c32 100644 --- a/Configuration/TypoScript/setup.typoscript +++ b/Configuration/TypoScript/setup.typoscript @@ -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 - } -} diff --git a/README.rst b/README.rst index 11404b1..2981f2d 100644 --- a/README.rst +++ b/README.rst @@ -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. diff --git a/composer.json b/composer.json index 9a08a40..0f2409d 100644 --- a/composer.json +++ b/composer.json @@ -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 } } } diff --git a/ext_emconf.php b/ext_emconf.php index 7076a7d..8b17fd2 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -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' => [], diff --git a/ext_localconf.php b/ext_localconf.php index c544be0..fbe740f 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -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');