Project

General

Profile

Actions

Bug #60635

closed

Cannot add calls/links to custom mobule in Page Tree context menu due to FormProtection mechanism

Added by Christian Heindl over 10 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Pagetree
Target version:
Start date:
2014-07-28
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
medium
Is Regression:
Yes
Sprint Focus:

Description

In a project I have added some custom entries within the page tree context menu via typoscript:

// ext_tables.php

$baseUrl = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl(
'web_MyModule',
array(
'tx_myextension_web_mymodule[action]' => 'myAction',
'tx_myextension_web_mymodule[controller]' => 'MyController',
'id' => '###ID###',
)
);
$GLOBALS['TYPO3_CONF_VARS']['BE']['defaultUserTSconfig'] .= '
options.contextMenu {
750 = ITEM
750 {
name = clickMenuCustomAction
label = Menu Item
icon = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY) . 'ext_icon.gif') . '
spriteIcon =
callbackAction = openCustomUrlInContentFrame
customAttributes.contentUrl = '.$baseUrl.'
}
'
?>

Add URL contains a "moduleToken" parameter, but it is "dummyToken". This seems to be generated by the DisabledFormProtection.php. But when "mod.php" is called, BackendFormProtection is used to validate the parameter.

Problems:
  • Here I'm using PHP to generate the custom entry within the page tree context menu. But there are cases, where i would configure such page tree context menu entry within static Typoscript. We need a portable solution to generate valid links to custom modules.
  • The code above is only executed once, so even calls to BackendUtility::getModuleUrl(..) would not retrieve a valid moduleToken, as it is only executed during the initialization of TYPO3 and will be cached across sessions.

Before 6.2 it was no problem to add page tree context menu entries with typoscript (or like above from PHP)

Actions

Also available in: Atom PDF