Skip to content

Commit

Permalink
[TASK] Add full TYPO3 v13 compatibility (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmack authored May 14, 2024
1 parent db30512 commit a606430
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
14 changes: 9 additions & 5 deletions Classes/ViewHelpers/GetDatabaseRecordViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Database\Query\Restriction\WorkspaceRestriction;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
Expand Down Expand Up @@ -78,17 +79,20 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl
$splitChar = $arguments['splitChar'] ?? self::DEFAULT_SPLIT_CHAR;
$uids = GeneralUtility::intExplode($splitChar, $arguments['uidList'], true);

$result = $queryBuilder
$queryBuilder
->select('*')
->from($table)
->where(
$queryBuilder->expr()->in('uid', $queryBuilder->createNamedParameter($uids, Connection::PARAM_INT_ARRAY))
)
->add('orderBy', 'FIELD(uid,' . implode(',', $uids ) . ')')
);
if ((new Typo3Version())->getMajorVersion() > 12) {
$queryBuilder->getConcreteQueryBuilder()->addOrderBy('FIELD(uid,' . implode(',', $uids ) . ')');
} else {
$queryBuilder->add('orderBy', 'FIELD(uid,' . implode(',', $uids ) . ')');
}
return $queryBuilder
->executeQuery()
->fetchAllAssociative();

return $result;
}

protected static function getQueryBuilder(string $table): QueryBuilder
Expand Down
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/RenderBodytextViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl
if ($arguments['crop'] === 0) {
$crop = 0;
} else {
$crop = $arguments['crop'] ? $arguments['crop'] : self::DEFAULT_CROP_VALUE;
$crop = $arguments['crop'] ?: self::DEFAULT_CROP_VALUE;
}
$value = $arguments['value'];
$keepTags = $arguments['keepTags'] ? explode(',', str_replace(' ', '', $arguments['keepTags'])): self::DEFAULT_KEEP_TAGS_LIST;
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# EXT:backendpreviews
# Nice Backend Previews for Content Elements in TYPO3

## About this extension

This extension adds a hook for rendering content element previews for TYPO3's backend view in the page module,
This extension adds a hook for rendering content element previews for TYPO3's backend view in the page module,
adding the ability to use Fluid Partials and Layouts to enable consistent preview markup.

## Installation
Expand Down Expand Up @@ -31,7 +31,7 @@ mod.web_layout.tt_content.preview.view {
}
```

By default, we will try to find a template to render a preview based on the CType of the element,
By default, we will try to find a template to render a preview based on the CType of the element,
meaning for CType `mytype` we will try to find a template named `Mytype.html` in one of the paths defined
in the `templateRootPaths`-Array.

Expand All @@ -55,22 +55,21 @@ All flexform data of the plugin are available in `{pi_flexform_transformed}` to

## Use custom backend previews for default CTypes

Default CTypes for `fluid_styled_content` define dedicated `previewRenderer` classes. If you want to use `EXT:backendpreviews` instead,
Default CTypes for `fluid_styled_content` define dedicated `previewRenderer` classes. If you want to use `EXT:backendpreviews` instead,
remove the configuration for each of these CTypes in your extension's `ext_localconf.php`:

```
unset($GLOBALS['TCA']['tt_content']['types']['textpic']['previewRenderer']);
```

>>>>>>> master
## License

As TYPO3 Core, _backendpreviews_ is licensed under GPL2 or later. See the LICENSE file for more details.

## Background, Authors & Further Maintenance

`EXT:backendpreviews` was initially created by David Steeb in 2021 for [b13, Stuttgart](https://b13.com). We use this as
a basis to add consistent previews for our custom content element types.
`EXT:backendpreviews` was initially created by David Steeb in 2021 for [b13, Stuttgart](https://b13.com). We use this as
a basis to add consistent previews for our custom content element types.

[Find more TYPO3 extensions we have developed](https://b13.com/useful-typo3-extensions-from-b13-to-you) that help us
deliver value in client projects. As part of the way we work, we focus on testing and best practices to ensure long-term
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'state' => 'stable',
'clearCacheOnLoad' => true,
'author_company' => 'b13 GmbH, Stuttgart',
'version' => '1.0.8',
'version' => '1.1.0',
'constraints' => [
'depends' => [
'typo3' => '10.4.0-12.99.99',
Expand Down

0 comments on commit a606430

Please sign in to comment.