diff --git a/Classes/Hooks/DrawItem.php b/Classes/Hooks/DrawItem.php index bd0a25b..f40cc85 100644 --- a/Classes/Hooks/DrawItem.php +++ b/Classes/Hooks/DrawItem.php @@ -29,6 +29,7 @@ use TYPO3\CMS\Backend\View\PageLayoutViewDrawFooterHookInterface; use TYPO3\CMS\Backend\View\PageLayoutViewDrawItemHookInterface; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; +use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder; @@ -109,7 +110,8 @@ class DrawItem implements PageLayoutViewDrawItemHookInterface, SingletonInterfac public function __construct() { - $this->extentensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['gridelements']); + $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class); + $this->extentensionConfiguration = $extConf->get('gridelements'); $this->setLanguageService($GLOBALS['LANG']); $this->helper = Helper::getInstance(); $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); diff --git a/Classes/Hooks/PageRenderer.php b/Classes/Hooks/PageRenderer.php index be2d131..483377f 100644 --- a/Classes/Hooks/PageRenderer.php +++ b/Classes/Hooks/PageRenderer.php @@ -30,7 +30,7 @@ use TYPO3\CMS\Core\Imaging\IconFactory; use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Recordlist\RecordList; +use TYPO3\CMS\Recordlist\Controller\RecordListController; /** * Class/Function which adds the necessary ExtJS and pure JS stuff for the grid elements. @@ -57,8 +57,8 @@ class PageRenderer implements SingletonInterface */ public function addJSCSS(array $parameters, \TYPO3\CMS\Core\Page\PageRenderer $pageRenderer) { - if (!empty($GLOBALS['SOBE']) && (get_class($GLOBALS['SOBE']) === RecordList::class || is_subclass_of($GLOBALS['SOBE'], - RecordList::class))) { + if (!empty($GLOBALS['SOBE']) && (get_class($GLOBALS['SOBE']) === RecordListController::class || is_subclass_of($GLOBALS['SOBE'], + RecordListController::class))) { $pageRenderer->loadRequireJsModule('TYPO3/CMS/Gridelements/GridElementsOnReady'); return; } @@ -76,7 +76,7 @@ public function addJSCSS(array $parameters, \TYPO3\CMS\Core\Page\PageRenderer $p $clipObj->lockToNormal(); $clipBoard = $clipObj->clipData['normal']; if (!$pageRenderer->getCharSet()) { - $pageRenderer->setCharSet($GLOBALS['LANG']->charSet ? $GLOBALS['LANG']->charSet : 'utf-8'); + $pageRenderer->setCharSet('utf-8'); } // pull locallang_db.xml to JS side - only the tx_gridelements_js-prefixed keys diff --git a/Classes/Xclass/DatabaseRecordList.php b/Classes/Xclass/DatabaseRecordList.php index 2ea601d..d0ad500 100644 --- a/Classes/Xclass/DatabaseRecordList.php +++ b/Classes/Xclass/DatabaseRecordList.php @@ -17,6 +17,7 @@ use TYPO3\CMS\Backend\Module\BaseScriptClass; use TYPO3\CMS\Backend\RecordList\RecordListGetTableHookInterface; +use TYPO3\CMS\Backend\Routing\UriBuilder; use TYPO3\CMS\Backend\Template\Components\ButtonBar; use TYPO3\CMS\Backend\Template\DocumentTemplate; use TYPO3\CMS\Backend\Template\ModuleTemplate; @@ -37,6 +38,7 @@ use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\HttpUtility; +use TYPO3\CMS\Extbase\Persistence\Generic\Query; use TYPO3\CMS\Frontend\Page\PageRepository; use TYPO3\CMS\Recordlist\RecordList\RecordListHookInterface; @@ -303,8 +305,9 @@ public function getButtons() } // New record on pages that are not locked by editlock if (!$module->modTSconfig['properties']['noCreateRecordsLink'] && $this->editLockPermissions()) { - $onClick = htmlspecialchars('return jumpExt(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('db_new', - ['id' => $this->id])) . ');'); + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $onClick = htmlspecialchars('return jumpExt(' . GeneralUtility::quoteJSvalue( + $uriBuilder->buildUriFromRoute('db_new', ['id' => $this->id])) . ');'); $buttons['new_record'] = '' . $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL)->render() . ''; @@ -350,7 +353,8 @@ public function getButtons() . $this->iconFactory->getIcon('actions-document-export-csv', Icon::SIZE_SMALL)->render() . ''; // Export if (ExtensionManagementUtility::isLoaded('impexp')) { - $url = BackendUtility::getModuleUrl('xMOD_tximpexp', ['tx_impexp[action]' => 'export']); + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $url = $uriBuilder->buildUriFromRoute('xMOD_tximpexp', ['tx_impexp[action]' => 'export']); $buttons['export'] = '' @@ -449,8 +453,9 @@ public function getDocHeaderButtons(ModuleTemplate $moduleTemplate) } // New record on pages that are not locked by editlock if (!$module->modTSconfig['properties']['noCreateRecordsLink'] && $this->editLockPermissions()) { - $onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('db_new', - ['id' => $this->id])) . ');'; + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue( + $uriBuilder->buildUriFromRoute('db_new', ['id' => $this->id])) . ');'; $newRecordButton = $buttonBar->makeLinkButton() ->setHref('#') ->setOnClick($onClick) @@ -516,7 +521,8 @@ public function getDocHeaderButtons(ModuleTemplate $moduleTemplate) $buttonBar->addButton($csvButton, ButtonBar::BUTTON_POSITION_LEFT, 40); // Export if (ExtensionManagementUtility::isLoaded('impexp')) { - $url = BackendUtility::getModuleUrl('xMOD_tximpexp', ['tx_impexp[action]' => 'export']); + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $url = $uriBuilder->buildUriFromRoute('xMOD_tximpexp', ['tx_impexp[action]' => 'export']); $exportButton = $buttonBar->makeLinkButton() ->setHref($url . '&tx_impexp[list][]=' . rawurlencode($this->table . ':' . $this->id)) ->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:rm.export')) @@ -712,7 +718,7 @@ public function getTable($table, $id, $rowList = '') $this->selFieldList = $selFieldList; if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'] as $classData) { - $hookObject = GeneralUtility::getUserObj($classData); + $hookObject = GeneralUtility::makeInstance($classData); if (!$hookObject instanceof RecordListGetTableHookInterface) { throw new \UnexpectedValueException($classData . ' must implement interface ' . RecordListGetTableHookInterface::class, 1195114460); @@ -1279,7 +1285,7 @@ public function renderListRow($table, $row, $cc, $titleCol, $thumbsCol, $indent */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) { - $hookObject = GeneralUtility::getUserObj($classData); + $hookObject = GeneralUtility::makeInstance($classData); if (is_object($hookObject) && method_exists($hookObject, 'checkChildren')) { $hookObject->checkChildren($table, $row, $level, $theData, $this); } @@ -1319,9 +1325,16 @@ function ($attributeValue) { // $lRow isn't always what we want - if record was moved we've to work with the // placeholder records otherwise the list is messed up a bit if ($row['_MOVE_PLH_uid'] && $row['_MOVE_PLH_pid']) { - $where = 't3ver_move_id="' . (int)$lRow['uid'] . '" AND pid="' . $row['_MOVE_PLH_pid'] - . '" AND t3ver_wsid=' . $row['t3ver_wsid'] . BackendUtility::deleteClause($table); - $tmpRow = BackendUtility::getRecordRaw($table, $where, $this->selFieldList); + /** @var QueryBuilder $qbuilder */ + $qBuilder = GeneralUtility::makeInstance( QueryBuilder::class ); + $qBuilder->select($this->selFieldList) + ->from($table) + ->where([ + 't3ver_move_id' => (int)$lRow['uid'], + 'pid' => $row['_MOVE_PLH_pid'], + 't3ver_wsid' => $row['t3ver_wsid'] . BackendUtility::deleteClause($table) + ]); + $tmpRow = $qBuilder->execute()->fetchAll(); $lRow = is_array($tmpRow) ? $tmpRow : $lRow; } // In offline workspace, look for alternative record: @@ -1513,7 +1526,9 @@ public function makeControl($table, $row) $this->addActionToCellGroup($cells, $viewBigAction, 'viewBig'); // "Move" wizard link for pages/tt_content elements: if ($permsEdit && ($table === 'tt_content' || $table === 'pages')) { - $onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('move_element') . '&table=' . $table . '&uid=' . $row['uid']) . ');'; + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue( + $uriBuilder->buildUriFromRoute('move_element' ) . '&table=' . $table . '&uid=' . $row['uid']) . ');'; $linkTitleLL = htmlspecialchars($this->getLanguageService()->getLL('move_' . ($table === 'tt_content' ? 'record' : 'page'))); $icon = ($table === 'pages' ? $this->iconFactory->getIcon('actions-page-move', Icon::SIZE_SMALL) : $this->iconFactory->getIcon('actions-document-move', Icon::SIZE_SMALL)); @@ -1523,7 +1538,8 @@ public function makeControl($table, $row) // If the table is NOT a read-only table, then show these links: if ($this->isEditable($table)) { // "Revert" link (history/undo) - $moduleUrl = BackendUtility::getModuleUrl('record_history', ['element' => $table . ':' . $row['uid']]); + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $moduleUrl = $uriBuilder->buildUriFromRoute('record_history', ['element' => $table . ':' . $row['uid']]); $onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue($moduleUrl) . ',\'#latest\');'; $historyAction = '' @@ -1535,7 +1551,8 @@ public function makeControl($table, $row) $this->getBackendUserAuthentication()->workspace, false, $row); // If table can be versionized. if (is_array($vers)) { - $href = BackendUtility::getModuleUrl('web_txversionM1', [ + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $href = $uriBuilder->buildUriFromRoute('web_txversionM1', [ 'table' => $table, 'uid' => $row['uid'], ]); @@ -1548,7 +1565,8 @@ public function makeControl($table, $row) // "Edit Perms" link: if ($table === 'pages' && $this->getBackendUserAuthentication()->check('modules', 'system_BeuserTxPermission') && ExtensionManagementUtility::isLoaded('beuser')) { - $href = BackendUtility::getModuleUrl('system_BeuserTxPermission') . '&id=' . $row['uid'] . '&returnId=' . $row['uid'] . '&tx_beuser_system_beusertxpermission[action]=edit'; + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $href = $uriBuilder->buildUriFromRoute('system_BeuserTxPermission') . '&id=' . $row['uid'] . '&returnId=' . $row['uid'] . '&tx_beuser_system_beusertxpermission[action]=edit'; $permsAction = '' . $this->iconFactory->getIcon('actions-lock', Icon::SIZE_SMALL)->render() . ''; @@ -1731,7 +1749,7 @@ public function makeControl($table, $row) } } foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) { - $hookObject = GeneralUtility::getUserObj($classData); + $hookObject = GeneralUtility::makeInstance($classData); if (!$hookObject instanceof RecordListHookInterface) { throw new \UnexpectedValueException($classData . ' must implement interface ' . RecordListHookInterface::class, 1195567840); @@ -2033,7 +2051,7 @@ public function makeClip($table, $row) */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) { - $hookObject = GeneralUtility::getUserObj($classData); + $hookObject = GeneralUtility::makeInstance($classData); if (!$hookObject instanceof RecordListHookInterface) { throw new \UnexpectedValueException($classData . ' must implement interface ' . RecordListHookInterface::class, 1195567845); @@ -2150,7 +2168,7 @@ public function addElement($h, $icon, $data, $rowParams = '', $_ = '', $_2 = '', */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) { - $hookObject = GeneralUtility::getUserObj($classData); + $hookObject = GeneralUtility::makeInstance($classData); if (is_object($hookObject) && method_exists($hookObject, 'contentCollapseIcon')) { $hookObject->contentCollapseIcon($data, $sortField, $level, $contentCollapseIcon, $this); } @@ -2466,7 +2484,7 @@ public function renderListHeader($table, $currentIdList) */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) { - $hookObject = GeneralUtility::getUserObj($classData); + $hookObject = GeneralUtility::makeInstance($classData); if (!$hookObject instanceof RecordListHookInterface) { throw new \UnexpectedValueException($classData . ' must implement interface ' . RecordListHookInterface::class, 1195567850); @@ -2509,7 +2527,8 @@ class="btn btn-default t3js-toggle-gridelements-all" href="#t3-gridelements-expa $newContentElementWizard = isset($tmpTSc['properties']['newContentElementWizard.']['override']) ? $tmpTSc['properties']['newContentElementWizard.']['override'] : 'new_content_element'; - $newContentWizScriptPath = BackendUtility::getModuleUrl($newContentElementWizard, + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $newContentWizScriptPath = $uriBuilder->buildUriFromRoute($newContentElementWizard, ['id' => $this->id]); $onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue($newContentWizScriptPath) . ');'; @@ -2521,7 +2540,8 @@ class="btn btn-default t3js-toggle-gridelements-all" href="#t3-gridelements-expa 'pagesOnly' => 1, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI'), ]; - $href = BackendUtility::getModuleUrl('db_new', $parameters); + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + $href = $uriBuilder->buildUriFromRoute('db_new', $parameters); $icon = '' . $spriteIcon->render() . ''; } else { @@ -2628,7 +2648,7 @@ class="btn btn-default t3js-toggle-gridelements-all" href="#t3-gridelements-expa */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) { - $hookObject = GeneralUtility::getUserObj($classData); + $hookObject = GeneralUtility::makeInstance($classData); if (!$hookObject instanceof RecordListHookInterface) { throw new \UnexpectedValueException($classData . ' must implement interface ' . RecordListHookInterface::class, 1195567855); @@ -2760,10 +2780,11 @@ public function outputCSV($prefix) public function pasteUrl($table, $uid, $setRedirect = true, array $update = null) { $formProtection = FormProtectionFactory::get(); - return ($table === '_FILE' ? BackendUtility::getModuleUrl('tce_file', - []) : BackendUtility::getModuleUrl('tce_db', [])) + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); + return ($table === '_FILE' ? $uriBuilder->buildUriFromRoute('tce_file', []) + : $uriBuilder->buildUriFromRoute('tce_db', [])) . ($setRedirect ? '&redirect=' . rawurlencode(GeneralUtility::linkThisScript(['CB' => ''])) : '') - . '&vC=' . $this->getBackendUserAuthentication()->veriCode() . '&prErr=1&uPT=1' . '&CB[paste]=' + . '&prErr=1&uPT=1' . '&CB[paste]=' . rawurlencode($table . '|' . $uid) . '&CB[pad]=' . $this->clipObj->current . (is_array($update) ? GeneralUtility::implodeArrayForUrl('CB[update]', $update) : '') . '&formToken=' . $formProtection->generateToken('tceAction'); diff --git a/composer.json b/composer.json index e6de27c..b76d2e6 100644 --- a/composer.json +++ b/composer.json @@ -12,10 +12,10 @@ "issues": "https://forge.typo3.org/projects/extension-gridelements2/issues" }, "require": { - "typo3/cms-core": "^9.3 || dev-master", - "typo3/cms-backend": "^9.3 || dev-master", - "typo3/cms-recordlist": "^9.3 || dev-master", - "typo3/cms-frontend": "^9.3 || dev-master" + "typo3/cms-core": "^9.5 || dev-master", + "typo3/cms-backend": "^9.5 || dev-master", + "typo3/cms-recordlist": "^9.5 || dev-master", + "typo3/cms-frontend": "^9.5 || dev-master" }, "conflict": { "templavoila": "*", diff --git a/ext_tables.php b/ext_tables.php index 5419779..9e4f271 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -24,7 +24,8 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = \GridElementsTeam\Gridelements\Hooks\DataHandler::class; $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'][] = \GridElementsTeam\Gridelements\Hooks\DataHandler::class; - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['getFlexFormDSClass'][] = \GridElementsTeam\Gridelements\Hooks\BackendUtilityGridelements::class; + $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools::class]['flexParsing'][] = \GridElementsTeam\Gridelements\Hooks\BackendUtilityGridelements::class; + // $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['getFlexFormDSClass'][] = \GridElementsTeam\Gridelements\Hooks\BackendUtilityGridelements::class; $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tx_templavoila_api']['apiIsRunningTCEmain'] = true;