diff --git a/Classes/Eel/Helper/PackageManagerHelper.php b/Classes/Eel/Helper/PackageManagerHelper.php new file mode 100644 index 0000000..7f8ffea --- /dev/null +++ b/Classes/Eel/Helper/PackageManagerHelper.php @@ -0,0 +1,58 @@ +getNeosUiVersion()); + } + + /** + * @return string + */ + public function getNeosUiMinorVersion(): string + { + return preg_replace('#^v?(\d+)\.(\d+)\.(\d+)$#', '$1.$2', $this->getNeosUiVersion()); + } + + /** + * @return string + */ + public function getNeosUiVersion(): string + { + try { + $packageManager = $this->objectManager->get(PackageManager::class); + $neosUiPackage = $packageManager->getPackage('Neos.Neos.Ui'); + return $neosUiPackage->getInstalledVersion(); + } catch (UnknownPackageException $e) { + return '0.0.0'; + } + } + + /** + * All methods are considered safe + * + * @param string $methodName + * @return boolean + */ + public function allowsCallOfMethod($methodName): bool + { + return true; + } +} diff --git a/Configuration/Settings.yaml b/Configuration/Settings.yaml index 7b930a9..d5ccdc7 100644 --- a/Configuration/Settings.yaml +++ b/Configuration/Settings.yaml @@ -1,4 +1,7 @@ Neos: + Fusion: + defaultContext: + 'Breadlesscode.NodeTypes.Folder.PackageManager': 'Breadlesscode\NodeTypes\Folder\Eel\Helper\PackageManagerHelper' Neos: userInterface: translation: diff --git a/Resources/Private/Fusion/Document/Folder.fusion b/Resources/Private/Fusion/Document/Folder.fusion index 74d41de..a31a163 100644 --- a/Resources/Private/Fusion/Document/Folder.fusion +++ b/Resources/Private/Fusion/Document/Folder.fusion @@ -26,16 +26,22 @@ prototype(Breadlesscode.NodeTypes.Folder:Document.Folder) < prototype(Neos.Fusio } body { templatePath = 'resource://Breadlesscode.NodeTypes.Folder/Private/Templates/Folder.html' - title = ${q(node).property('title')} + title = ${q(documentNode).property('title')} + version = ${Breadlesscode.NodeTypes.Folder.PackageManager.getNeosUiMajorVersion()} } } } default { condition = true - renderer = Neos.Neos:Page { - body = Neos.Neos:Shortcut { - targetMode = 'parentNode' + renderer = Neos.Fusion:Http.Message { + httpResponseHead { + statusCode = 301 + headers { + Location = Neos.Neos:NodeUri { + node = ${q(documentNode).parent().get(0)} + } + } } } } diff --git a/Resources/Private/Templates/Folder.html b/Resources/Private/Templates/Folder.html index 915e026..abee294 100644 --- a/Resources/Private/Templates/Folder.html +++ b/Resources/Private/Templates/Folder.html @@ -1,4 +1,4 @@ -
+
{title}
diff --git a/Resources/Public/Styles/Folder.css b/Resources/Public/Styles/Folder.css index 7ff4c3d..c87aa64 100644 --- a/Resources/Public/Styles/Folder.css +++ b/Resources/Public/Styles/Folder.css @@ -6,16 +6,19 @@ height: 100%; background-color: #222222; z-index: 9999; - /* - The Neos 7 backend normally uses the "Noto Sans" font, - which is no longer available as of 14 January 2023 in - the Neos.Neos package due to an incorrect file path in - Neos.css. - */ - font-family: sans-serif; + font-family: "Noto Sans", sans-serif; -webkit-font-smoothing: antialiased; } +/* +The Neos backend normally uses the "Noto Sans" font, +which is not available in Neos 5 due to an incorrect +file path in Neos.css. +*/ +#breadlesscode-node-types-folder.btnf-neos-version-5 { + font-family: sans-serif; +} + #breadlesscode-node-types-folder > div.bntf-inner { position: relative; width: 260px;