Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions Classes/ViewHelpers/ExplodeListViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,11 @@
*/
class ExplodeListViewHelper extends AbstractViewHelper
{
use CompileWithContentArgumentAndRenderStatic;

/**
* Default split char, used as fallback.
*/
const DEFAULT_SPLIT_CHAR = ',';

/**
* Initialize arguments.
*
* @api
*/
public function initializeArguments(): void
{
parent::initializeArguments();
Expand All @@ -60,20 +53,14 @@ public function initializeArguments(): void
);
}

/**
* @param array $arguments
* @param \Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
* @return array
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext): array
public function render()
{
if ($arguments['splitNL'] !== false) {
if (($this->arguments['splitNL'] ?? false) !== false) {
$splitChar = PHP_EOL;
} else {
$splitChar = $arguments['splitChar'] ?? self::DEFAULT_SPLIT_CHAR;
$splitChar = $this->arguments['splitChar'] ?? self::DEFAULT_SPLIT_CHAR;
}
$value = $arguments['value'] ?? $renderChildrenClosure();
$value = $this->arguments['value'] ?? $renderChildrenClosure();
return explode($splitChar, (string)$value);
}
}
21 changes: 4 additions & 17 deletions Classes/ViewHelpers/GetDatabaseRecordViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,12 @@
*/
class GetDatabaseRecordViewHelper extends AbstractViewHelper
{
use CompileWithContentArgumentAndRenderStatic;

/**
* Defaults
*/
const DEFAULT_TABLE = 'tt_content';
const DEFAULT_SPLIT_CHAR = ',';

/**
* Initialize arguments.
*
* @api
*/
public function initializeArguments(): void
{
parent::initializeArguments();
Expand All @@ -66,18 +59,12 @@ public function initializeArguments(): void
);
}

/**
* @param array $arguments
* @param \Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
* @return array
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext): array
public function render(): array
{
$table = $arguments['table'] ?? self::DEFAULT_TABLE;
$table = $this->arguments['table'] ?? self::DEFAULT_TABLE;
$queryBuilder = self::getQueryBuilder($table);
$splitChar = $arguments['splitChar'] ?? self::DEFAULT_SPLIT_CHAR;
$uids = GeneralUtility::intExplode($splitChar, (string)$arguments['uidList'], true);
$splitChar = $this->arguments['splitChar'] ?? self::DEFAULT_SPLIT_CHAR;
$uids = GeneralUtility::intExplode($splitChar, (string)($this->arguments['uidList'] ?? ''), true);
if ($uids === []) {
return [];
}
Expand Down
28 changes: 7 additions & 21 deletions Classes/ViewHelpers/RenderBodytextViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,14 @@
* View helper to process bodytext field values for backend preview, similar to PageLayoutView:renderText().
*/
class RenderBodytextViewHelper extends AbstractViewHelper
{
use CompileWithContentArgumentAndRenderStatic;

/**
{/**
* Default crop value, used as fallback.
*/
const DEFAULT_CROP_VALUE = 1500;

const DEFAULT_KEEP_TAGS_LIST = ['ol', 'ul', 'li'];

/**
* Initialize arguments.
*
* @api
*/
public function initializeArguments()
public function initializeArguments(): void
{
parent::initializeArguments();
$this->registerArgument(
Expand All @@ -61,21 +53,15 @@ public function initializeArguments()
);
}

/**
* @param array $arguments
* @param \Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
* @return string
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
public function render()
{
if ($arguments['crop'] === 0) {
if (($this->arguments['crop'] ?? 0) === 0) {
$crop = 0;
} else {
$crop = $arguments['crop'] ?: self::DEFAULT_CROP_VALUE;
$crop = $this->arguments['crop'] ?: self::DEFAULT_CROP_VALUE;
}
$value = $arguments['value'];
$keepTags = $arguments['keepTags'] ? explode(',', str_replace(' ', '', $arguments['keepTags'])): self::DEFAULT_KEEP_TAGS_LIST;
$value = $this->arguments['value'];
$keepTags = $this->arguments['keepTags'] ? explode(',', str_replace(' ', '', $this->arguments['keepTags'])): self::DEFAULT_KEEP_TAGS_LIST;
if ($value === null) {
$value = $renderChildrenClosure();
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"require": {
"php": "^7.4 || ~8.0",
"typo3/cms-core": "^10.4 || ^11.5 || ^12.1 || ^13.0"
"typo3/cms-core": "^10.4 || ^11.5 || ^12.1 || ^13.0 || ^14.0"
},
"suggest": {
"b13/listelements": "*"
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
'version' => '1.4.3',
'constraints' => [
'depends' => [
'typo3' => '10.4.0-13.99.99',
'typo3' => '10.4.0-14.99.99',
],
],
];