diff --git a/Classes/ViewHelpers/GetDatabaseRecordViewHelper.php b/Classes/ViewHelpers/GetDatabaseRecordViewHelper.php index 1edda36..40b9b60 100644 --- a/Classes/ViewHelpers/GetDatabaseRecordViewHelper.php +++ b/Classes/ViewHelpers/GetDatabaseRecordViewHelper.php @@ -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; @@ -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 diff --git a/Classes/ViewHelpers/RenderBodytextViewHelper.php b/Classes/ViewHelpers/RenderBodytextViewHelper.php index d1d5272..04030ce 100644 --- a/Classes/ViewHelpers/RenderBodytextViewHelper.php +++ b/Classes/ViewHelpers/RenderBodytextViewHelper.php @@ -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; diff --git a/README.md b/README.md index cf8ea1a..c7a42db 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. @@ -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 diff --git a/ext_emconf.php b/ext_emconf.php index a4df429..a88f085 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -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',