Skip to content

Commit

Permalink
feat: add compatibility with TYPO3 v13
Browse files Browse the repository at this point in the history
  • Loading branch information
brotkrueml committed Feb 13, 2024
1 parent c39ab4a commit b79f6ef
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ jobs:
typo3-versions: ^12
- php-versions: 8.2
typo3-versions: ^12
- php-versions: 8.2
typo3-versions: ^13
- php-versions: 8.3
typo3-versions: ^12
- php-versions: 8.3
typo3-versions: ^13
steps:
- name: Check out repository
uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- Compatibility with TYPO3 v13

### Removed
- Compatibility with TYPO3 v11 (#36)

Expand Down
2 changes: 1 addition & 1 deletion Classes/Preview/ContentPreviewRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function renderPageModulePreviewContent(GridColumnItem $item): string
public function renderPageModulePreviewFooter(GridColumnItem $item): string
{
$record = $item->getRecord();
$settings = $this->getFlexFormSettings($record['pi_flexform']);
$settings = $this->getFlexFormSettings($record['pi_flexform'] ?? '');

$footer = [];
if (($settings['programmingLanguage'] ?? '') !== '') {
Expand Down
2 changes: 1 addition & 1 deletion Classes/UserFunctions/CodeSnippetGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function generate(
$this->addJsFile(Extension::PRISM_BASE_PATH . 'components/prism-core.min.js');
$this->addJsFile(Extension::PRISM_BASE_PATH . 'plugins/autoloader/prism-autoloader.min.js', false);

$options = new Options($this->flexFormService->convertFlexFormContentToArray($this->cObj->data['pi_flexform']));
$options = new Options($this->flexFormService->convertFlexFormContentToArray($this->cObj->data['pi_flexform'] ?? ''));

$event = new EnrichCodeSnippetEvent(
$siteConfiguration,
Expand Down
9 changes: 7 additions & 2 deletions Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

use Brotkrueml\CodeHighlight\Extension;
use Brotkrueml\CodeHighlight\Preview\ContentPreviewRenderer;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Extbase\Utility\ExtensionUtility;

defined('TYPO3') || die();

Expand All @@ -24,7 +24,7 @@
'EXT:' . Extension::KEY . '/Resources/Public/Icons/content-codehighlight.svg',
'special',
],
ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT,
'CType',
Extension::KEY,
);

Expand Down Expand Up @@ -70,8 +70,13 @@
];

if (ExtensionManagementUtility::isLoaded('t3editor')) {
// @todo Remove when compatibility with TYPO3 v12 is dropped
$GLOBALS['TCA']['tt_content']['types'][$contentType]['columnsOverrides']['bodytext']['config']['renderType'] = 't3editor';
}
if ((new Typo3Version())->getMajorVersion() >= 13) {
// @todo Always assign the renderType when compatibility with TYPO3 v12 is dropped
$GLOBALS['TCA']['tt_content']['types'][$contentType]['columnsOverrides']['bodytext']['config']['renderType'] = 'codeEditor';
}

$GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes'][$contentType] = 'content-codehighlight';
})();
6 changes: 6 additions & 0 deletions Documentation/Changelog/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0
`Unreleased <https://github.com/brotkrueml/codehighlight/compare/v3.1.1...HEAD>`_
-------------------------------------------------------------------------------------

Added
^^^^^


* Compatibility with TYPO3 v13

Removed
^^^^^^^

Expand Down
7 changes: 4 additions & 3 deletions Documentation/Installation/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Installation
Target group: **Administrators**

.. note::
The extension in version |version| supports TYPO3 v12 LTS.
The extension in version |version| supports TYPO3 v12 LTS and TYPO3 v13.
Use version 3.x for support of TYPO3 v11.
Use version 2.x for support of TYPO3 v9 LTS and TYPO3 v10 LTS.

Expand All @@ -18,8 +18,9 @@ Some basic configuration is available which is explained in the
:ref:`Configuration <configuration>` section.

.. tip::

Install the TYPO3 system extension "t3editor" to use the features of this editor in the backend content element.
Install the TYPO3 system extension "t3editor" on TYPO3 v12 to use the
features of this editor in the backend content element. In TYPO3 v13 the
code editor is always available.


.. _installation-composer:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Code highlighter for various programming, markup and configuration languages bas

| Latest release | TYPO3 | PHP | Updates will contain |
|----------------|-------------|-------|---------------------------------------------------|
| 4.x | 12.4 | ≥ 8.1 | Features, PrismJS updates, security and bug fixes |
| 4.x | 12.4 - 13.4 | ≥ 8.1 | Features, PrismJS updates, security and bug fixes |
| 3.x | 11.5 - 12.4 | ≥ 7.4 | Security fixes, end of life expected: Oct 24 |
| 2.x | 9.5 - 11.5 | ≥ 7.2 | End of life |
| 1.x | 9.5 - 10.4 | ≥ 7.2 | End of life |
Expand Down
11 changes: 5 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
],
"require": {
"php": ">= 8.1",
"typo3/cms-backend": "^12.4",
"typo3/cms-core": "^12.4",
"typo3/cms-fluid": "^12.4",
"typo3/cms-fluid-styled-content": "^12.4",
"typo3/cms-frontend": "^12.4"
"typo3/cms-backend": "^12.4 || ^13.0",
"typo3/cms-core": "^12.4 || ^13.0",
"typo3/cms-fluid": "^12.4 || ^13.0",
"typo3/cms-fluid-styled-content": "^12.4 || ^13.0",
"typo3/cms-frontend": "^12.4 || ^13.0"
},
"require-dev": {
"brotkrueml/coding-standards": "~5.1.0",
Expand Down Expand Up @@ -60,7 +60,6 @@
"dev-main": "4.0.x-dev"
},
"typo3/cms": {
"app-dir": ".Build",
"extension-key": "codehighlight",
"web-dir": ".Build/web"
}
Expand Down
4 changes: 2 additions & 2 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
'version' => '4.0.0-dev',
'constraints' => [
'depends' => [
'typo3' => '12.4.0-12.4.99',
'fluid_styled_content' => '12.4.0-12.4.99',
'typo3' => '12.4.0-13.4.99',
'fluid_styled_content' => '12.4.0-13.4.99',
],
'suggests' => [
't3editor' => '',
Expand Down

0 comments on commit b79f6ef

Please sign in to comment.