diff --git a/Classes/Hooks/Backend/Template/DocumentTemplate.php b/Classes/Hooks/Backend/Template/DocumentTemplate.php
index 9ffabe5..fe4fe8c 100644
--- a/Classes/Hooks/Backend/Template/DocumentTemplate.php
+++ b/Classes/Hooks/Backend/Template/DocumentTemplate.php
@@ -4,6 +4,7 @@
namespace Wazum\PagetreeResizable\Hooks\Backend\Template;
use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
/**
@@ -14,6 +15,62 @@
*/
class DocumentTemplate
{
+ /**
+ * Executed when makeInstance is used (= in the link handler)
+ * Used in TYPO3 v10, but can replace all other parts as well.
+ */
+ public function __construct()
+ {
+ if (TYPO3_MODE === 'BE') {
+ $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
+ if ($width = $this->getUserElementBrowserTreeWidth()) {
+ $pageRenderer->addCssInlineBlock('wazum/pagetree-resizable', '
+ .element-browser-main .element-browser-main-sidebar {
+ width: ' . $width . 'px;
+ }
+ ');
+ }
+ $this->includeRequiredResources();
+ }
+
+ }
+
+ /**
+ * Used within the main backend module to add JS + CSS.
+ */
+ public function mainBackendModule()
+ {
+ $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
+ if ($width = $this->getUserPageTreeWidth()) {
+ $pageRenderer->addCssInlineBlock('wazum/pagetree-resizable', '
+ .scaffold-content-navigation-expanded .scaffold-content-navigation {
+ width: ' . $width . 'px;
+ }
+ .scaffold-content-navigation-expanded .scaffold-content-module {
+ left: ' . $width . 'px;
+ }
+ ');
+ }
+ $this->includeRequiredResources();
+ }
+
+ /**
+ * Load CSS & JS resources into PageRenderer
+ */
+ protected function includeRequiredResources()
+ {
+ $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
+ list($version) = explode('.', VersionNumberUtility::getCurrentTypo3Version());
+ $pageRenderer->addCssFile('EXT:pagetree_resizable/Resources/Public/Stylesheet/PagetreeResizable.css');
+ if ((int)$version === 8) {
+ $pageRenderer->loadRequireJsModule('TYPO3/CMS/PagetreeResizable/PagetreeResizable8');
+ } else {
+ // TYPO3 9, 10
+ $pageRenderer->loadRequireJsModule('TYPO3/CMS/PagetreeResizable/PagetreeResizable9');
+ }
+
+ }
+
/**
* @param array $parameters
* @param \TYPO3\CMS\Backend\Template\DocumentTemplate $parent
diff --git a/Resources/Public/JavaScript/PagetreeResizable.js b/Resources/Public/JavaScript/PagetreeResizable.js
index eb47400..f1d8327 100644
--- a/Resources/Public/JavaScript/PagetreeResizable.js
+++ b/Resources/Public/JavaScript/PagetreeResizable.js
@@ -37,10 +37,10 @@ define([
isPageModule = true;
}
// Link browser
- else if ($('.element-browser .element-browser-main .element-browser-main-sidebar').length) {
- container = $('.element-browser .element-browser-main .element-browser-main-sidebar');
+ else if ($('.element-browser-main .element-browser-main-sidebar').length) {
+ container = $('.element-browser-main .element-browser-main-sidebar');
styles = function (width) {
- return '';
+ return '';
};
contentWidth = function () {
if ($('.element-browser-main-sidebar .element-browser-body ul.list-tree-root').length) {
@@ -54,6 +54,7 @@ define([
handles: 'e, w',
minWidth: 200,
create: function () {
+ console.debug(container);
container.find('.ui-resizable-e').dblclick(function (e) {
var width = contentWidth();
if (width !== false) {
diff --git a/Resources/Public/Stylesheet/PagetreeResizable.css b/Resources/Public/Stylesheet/PagetreeResizable.css
index efacafc..645bbb5 100644
--- a/Resources/Public/Stylesheet/PagetreeResizable.css
+++ b/Resources/Public/Stylesheet/PagetreeResizable.css
@@ -37,4 +37,4 @@
.element-browser .element-browser-main .element-browser-main-sidebar {
width: auto !important;
}
-}
+}
\ No newline at end of file
diff --git a/composer.json b/composer.json
index b2227ca..7de0735 100644
--- a/composer.json
+++ b/composer.json
@@ -4,7 +4,7 @@
"description": "Make the backend page tree horizontally resizable",
"require": {
"php": ">=7.0.0",
- "typo3/cms-core": "^8.7 || ^9.5 || ^10.2"
+ "typo3/cms-core": "^8.7 || ^9.5 || ^10.4"
},
"type": "typo3-cms-extension",
"version": "1.2.1",
diff --git a/ext_emconf.php b/ext_emconf.php
index 1ea9d63..e693838 100644
--- a/ext_emconf.php
+++ b/ext_emconf.php
@@ -12,7 +12,7 @@
'version' => '1.2.1',
'constraints' => [
'depends' => [
- 'typo3' => '8.7.0-10.2.99',
+ 'typo3' => '8.7.0-10.4.99',
]
]
];
diff --git a/ext_localconf.php b/ext_localconf.php
index a39a22c..b743789 100644
--- a/ext_localconf.php
+++ b/ext_localconf.php
@@ -5,4 +5,10 @@
if (TYPO3_MODE === 'BE') {
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['preHeaderRenderHook']['wazum/pagetree-resizeable'] =
\Wazum\PagetreeResizable\Hooks\Backend\Template\DocumentTemplate::class . '->preHeaderRenderHook';
+
+
+ // Necessary for TYPO3 v10
+ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['LinkBrowser']['hooks']['wazum/pagetree-resizeable']['handler'] = \Wazum\PagetreeResizable\Hooks\Backend\Template\DocumentTemplate::class;
+ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/backend.php']['renderPreProcess']['wazum/pagetree-resizeable'] =
+ \Wazum\PagetreeResizable\Hooks\Backend\Template\DocumentTemplate::class . '->mainBackendModule';
}