Skip to content

Commit

Permalink
[TASK] Cleanup navigation frame module registration
Browse files Browse the repository at this point in the history
http://review.typo3.org/37611 made the navigation frame dispatched.
For this it leveraged the addNavigationComponent API,
which was introduced only for ExtJS tree components.

Since we want to get rid of ExtJS (and this API specifically),
we need to introduce a different way to make modules or routes
navigation components.

This change reverts the above changes to the API and instead uses
the `navigationFrameModule` option which was introduced in
https://review.typo3.org/#/c/30593

To make this option work with top level modules and inheritance of
the navigation frame,
the evaluation of the option is moved to the module loader, which
has the benefit to have the code only in one place while it needed
to be in two places before.

Resolves: #69270
Releases: master
Change-Id: I7cb2ca2ee6d04001af424c88a1db828d1712caa1
Reviewed-on: http://review.typo3.org/42856
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
  • Loading branch information
helhum authored and liayn committed Aug 24, 2015
1 parent 5feea43 commit fec8612
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,7 @@ public function getRawModuleMenuData() {
$submoduleKey = $moduleName . '_' . $submoduleName . '_tab';
$submoduleDescription = $GLOBALS['LANG']->moduleLabels['labels'][$submoduleKey . 'label'];
$originalLink = $submoduleLink;
if (isset($submoduleData['navigationFrameModule'])) {
$navigationFrameScript = BackendUtility::getModuleUrl(
$submoduleData['navigationFrameModule'],
isset($submoduleData['navigationFrameModuleParameters'])
? $submoduleData['navigationFrameModuleParameters']
: array()
);
} else {
$navigationFrameScript = $submoduleData['navFrameScript'];
}
$navigationFrameScript = $submoduleData['navFrameScript'];
$modules[$moduleKey]['subitems'][$submoduleKey] = array(
'name' => $moduleName . '_' . $submoduleName,
'title' => $GLOBALS['LANG']->moduleLabels['tabs'][$submoduleKey],
Expand Down
34 changes: 15 additions & 19 deletions typo3/sysext/backend/Classes/Module/ModuleLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,18 +318,24 @@ public function checkMod($name, $fullPath) {
$finalModuleConfiguration['script'] = BackendUtility::getModuleUrl('dummy');
}

// Navigation Frame Script (GET params could be added)
if ($setupInformation['configuration']['navFrameScript']) {
if (!empty($setupInformation['configuration']['navigationFrameModule'])) {
$finalModuleConfiguration['navFrameScript'] = BackendUtility::getModuleUrl(
$setupInformation['configuration']['navigationFrameModule'],
!empty($setupInformation['configuration']['navigationFrameModuleParameters'])
? $setupInformation['configuration']['navigationFrameModuleParameters']
: array()
);
} elseif (!empty($setupInformation['configuration']['navFrameScript'])) {
// Navigation Frame Script (GET params could be added)
$navFrameScript = explode('?', $setupInformation['configuration']['navFrameScript']);
$navFrameScript = $navFrameScript[0];
if (file_exists($setupInformation['path'] . '/' . $navFrameScript)) {
$finalModuleConfiguration['navFrameScript'] = $this->getRelativePath(PATH_typo3, $fullPath . '/' . $setupInformation['configuration']['navFrameScript']);
}
}

// additional params for Navigation Frame Script: "&anyParam=value&moreParam=1"
if ($setupInformation['configuration']['navFrameScriptParam']) {
$finalModuleConfiguration['navFrameScriptParam'] = $setupInformation['configuration']['navFrameScriptParam'];
// Additional params for Navigation Frame Script: "&anyParam=value&moreParam=1"
if ($setupInformation['configuration']['navFrameScriptParam']) {
$finalModuleConfiguration['navFrameScriptParam'] = $setupInformation['configuration']['navFrameScriptParam'];
}
}

// Check if this is a submodule
Expand All @@ -340,20 +346,10 @@ public function checkMod($name, $fullPath) {

// check if there is a navigation component (like the pagetree)
if (is_array($this->navigationComponents[$name])) {
// the navigation component is a module, so the module URL is taken
if (isset($GLOBALS['TBE_MODULES']['_PATHS'][$this->navigationComponents[$name]['componentId']])) {
$finalModuleConfiguration['navFrameScript'] = BackendUtility::getModuleUrl($this->navigationComponents[$name]['componentId']);
} else {
$finalModuleConfiguration['navigationComponentId'] = $this->navigationComponents[$name]['componentId'];
}
$finalModuleConfiguration['navigationComponentId'] = $this->navigationComponents[$name]['componentId'];
// navigation component can be overriden by the main module component
} elseif ($mainModule && is_array($this->navigationComponents[$mainModule]) && $setupInformation['configuration']['inheritNavigationComponentFromMainModule'] !== FALSE) {
// the navigation component is a module, so the module URL is taken
if (isset($GLOBALS['TBE_MODULES']['_PATHS'][$this->navigationComponents[$mainModule]['componentId']])) {
$finalModuleConfiguration['navFrameScript'] = BackendUtility::getModuleUrl($this->navigationComponents[$mainModule]['componentId']);
} else {
$finalModuleConfiguration['navigationComponentId'] = $this->navigationComponents[$mainModule]['componentId'];
}
$finalModuleConfiguration['navigationComponentId'] = $this->navigationComponents[$mainModule]['componentId'];
}
return $finalModuleConfiguration;
}
Expand Down
11 changes: 1 addition & 10 deletions typo3/sysext/backend/Classes/View/ModuleMenuView.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,7 @@ public function getRawModuleData() {
$submoduleIcon = $this->getModuleIcon($submoduleKey);
$submoduleDescription = $GLOBALS['LANG']->moduleLabels['labels'][$submoduleKey . 'label'];
$originalLink = $submoduleLink;
if (isset($submoduleData['navigationFrameModule'])) {
$navigationFrameScript = BackendUtility::getModuleUrl(
$submoduleData['navigationFrameModule'],
isset($submoduleData['navigationFrameModuleParameters'])
? $submoduleData['navigationFrameModuleParameters']
: array()
);
} else {
$navigationFrameScript = $submoduleData['navFrameScript'];
}
$navigationFrameScript = $submoduleData['navFrameScript'];
$modules[$moduleKey]['subitems'][$submoduleKey] = array(
'name' => $moduleName . '_' . $submoduleName,
'title' => $GLOBALS['LANG']->moduleLabels['tabs'][$submoduleKey],
Expand Down
1 change: 0 additions & 1 deletion typo3/sysext/backend/ext_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
if (TYPO3_MODE === 'BE') {

// Register file_navframe
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addCoreNavigationComponent('file', 'file_navframe');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
'file_navframe',
'EXT:backend/Modules/FileSystemNavigationFrame/'
Expand Down
1 change: 1 addition & 0 deletions typo3/sysext/core/ext_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
'labels' => array(
'll_ref' => 'LLL:EXT:lang/locallang_mod_file.xlf'
),
'navigationFrameModule' => 'file_navframe',
'configuration' => array(
'name' => 'file',
'access' => 'user,group',
Expand Down

0 comments on commit fec8612

Please sign in to comment.