Skip to content

Commit

Permalink
Rebuild backend modules #360
Browse files Browse the repository at this point in the history
  • Loading branch information
digedag committed Feb 28, 2025
1 parent a7b74b1 commit c32e34b
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 33 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changelog
v1.20.0 ()
* Update for TYPO3 13.4 LTS
* BC: showMenu() in ToolBox is not static anymore
* BC: BEPager requires IModule in constructor

v1.19.3 (??.0?.2025)
* Migrate label translation
Expand Down
57 changes: 32 additions & 25 deletions Classes/Backend/Form/ToolBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -784,36 +784,43 @@ public function createDateInput($name, $value, array $options = [])
$value += date('Z', $value);
}
$this->initializeJavaScriptFormEngine();
$dateElementClass = TYPO3::isTYPO121OrHigher() ?
\TYPO3\CMS\Backend\Form\Element\DatetimeElement::class :
\TYPO3\CMS\Backend\Form\Element\InputDateTimeElement::class;

// [itemFormElName] => data[tx_cfcleague_games][4][status]
// [itemFormElID] => data_tx_cfcleague_games_4_status

$renderedElement = tx_rnbase::makeInstance(
$dateElementClass,
$this->getTCEForm()->getNodeFactory(),
[
'fieldName' => $name,
'tableName' => '',
'databaseRow' => ['uid' => 0],
'processedTca' => ['columns' => [$name => ['config' => ['type' => 'text']]]],
'parameterArray' => [
'itemFormElValue' => $value,
'itemFormElName' => $name,
'itemFormElID' => $name,
'fieldConf' => [
'label' => $options[self::OPTION_LABEL] ?? '',
'config' => [
'width' => 20,
'maxlength' => 20,
'eval' => 'datetime',
],
$options = [
'fieldName' => $name,
'tableName' => '',
'databaseRow' => ['uid' => 0],
'processedTca' => ['columns' => [$name => ['config' => ['type' => 'text']]]],
'parameterArray' => [
'itemFormElValue' => $value,
'itemFormElName' => $name,
'itemFormElID' => $name,
'fieldConf' => [
'label' => $options[self::OPTION_LABEL] ?? '',
'config' => [
'width' => 20,
'maxlength' => 20,
'eval' => 'datetime',
],
],
]
)->render();
],
];

if (!TYPO3::isTYPO130OrHigher()) {
$dateElementClass = TYPO3::isTYPO121OrHigher() ?
\TYPO3\CMS\Backend\Form\Element\DatetimeElement::class :
\TYPO3\CMS\Backend\Form\Element\InputDateTimeElement::class;

$renderedElement = tx_rnbase::makeInstance(
$dateElementClass,
$this->getTCEForm()->getNodeFactory(),
$options
)->render();
} else {
$options['renderType'] = 'datetime';
$renderedElement = $this->getTCEForm()->getNodeFactory()->create($options)->render();
}

if ($renderedElement['requireJsModules'] ?? null) {
$pageRenderer = $this->getDoc()->getPageRenderer();
Expand Down
2 changes: 1 addition & 1 deletion Classes/Backend/Lister/AbstractLister.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ protected function getPager()
tx_rnbase::makeInstance(
BEPager::class,
$this->getListerId().'Pager',
$this->getModule()->getName(),
$this->getModule(),
$this->getOptions()->getPid()
)
);
Expand Down
15 changes: 9 additions & 6 deletions Classes/Backend/Utility/BEPager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Sys25\RnBase\Backend\Utility;

use Sys25\RnBase\Backend\Form\ToolBox;
use Sys25\RnBase\Backend\Module\IModule;

/***************************************************************
* Copyright notice
*
* (c) 2008-2023 Rene Nitzsche ([email protected])
* (c) 2008-2025 Rene Nitzsche ([email protected])
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
Expand Down Expand Up @@ -41,14 +41,16 @@ class BEPager
private $settings;

private $init = false;
private $module;
private $modName;
private $conf;

public function __construct($id, $modName, $pid, $listSize = 0, $conf = [])
public function __construct($id, IModule $module, $pid, $listSize = 0, $conf = [])
{
$this->id = strlen(trim($id)) ? trim($id) : 'pager';
$this->pid = $pid;
$this->modName = $modName;
$this->module = $module;
$this->modName = $module->getName();
$this->conf = $conf;
$this->setListSize($listSize);
}
Expand Down Expand Up @@ -102,7 +104,8 @@ public function setState()
return;
}
$sizes = $this->getLimits();
$menu = ToolBox::showMenu($this->pid, $this->getDataName().'_limit', $this->modName, $sizes);
$toolbox = $this->module->getFormTool();
$menu = $toolbox->showMenu($this->pid, $this->getDataName().'_limit', $this->modName, $sizes);
$this->setSetting('limit', $menu['value']);
$this->setSetting('limitMenu', $menu['menu']);

Expand All @@ -118,7 +121,7 @@ public function setState()
}
$pages[$i * $results_at_a_time] = 'Seite '.$i;
}
$menu = ToolBox::showMenu($this->pid, $this->getDataName().'_offset', $this->modName, $pages);
$menu = $toolbox->showMenu($this->pid, $this->getDataName().'_offset', $this->modName, $pages);
$this->setSetting('offset', $menu['value']);
$this->setSetting('offsetMenu', $menu['menu']);
$this->init = true;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utility/LanguageTool.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function getLL($key, $alt = '', $hsc = false, $labelDebug = false): strin
}
}
if (empty($result)) {
$result = $this->getLanguageService()->sL($key);
$result = $alt;
}
} else {
$result = $this->localLangUtil->getLL($key, $alt, false, $labelDebug);
Expand Down

0 comments on commit c32e34b

Please sign in to comment.