How to change selected entry in TYPO3 pagetree

I am doing a backend extension that changes which page it works on by clicking the link in the workspace to the right of pagetree. The problem is that pagetree is not updated according to the identifier that is presented in the workspace.

The identifier is changed by passing the identifier of the request parameter to the mod.php module and works as expected. I tried updating the page tree with

  t3lib_BEfunc :: openPageTree ($ this-> id);
    t3lib_BEfunc :: setUpdateSignal ('updatePageTree'); 

and later

  <script type = "text / javascript"> '. t3lib_BEfunc :: getUpdateSignalCode ().' </script> 

for inclusion in the output. It also works (pagetree is updated and hidden subpages of the passed identifier are displayed), except that the greyness indicating the current page in the page tree remains at the same position.

Any idea on how to make pagetree a reflection of the new $this->id ?

+7
source share
2 answers

Here is how I did it. In the PHP module of my BE module, I called only openPageTree as follows:

 t3lib_BEfunc::openPageTree(76,false); 

I did not call setUpdateSignal because the whole process of “updating the signal” seemed a little strange to me. Also note that openPageTree now has a second parameter, which is required.

As far as I understand, this call should be enough to set the state of the tree on the session side of the user. Now comes the client side.

In the JavaScript code of my extension, I simply select the appropriate page identifier and that it:

 <script type="text/javascript"> if (top && top.TYPO3.Backend.NavigationContainer.PageTree) { top.TYPO3.Backend.NavigationContainer.PageTree.select(76); } </script> 

When viewing the source of the page tree, I realized that after the update, he will always select top.fsMod.recentIds['web'] . Unfortunately, I could not determine how to correctly enter the value there. It seemed to me that the value should be configured only through user interaction (this means that the user clicked on a node in the page tree).

+2
source

In TYPO3 6.1, you have a Javascript function to go to the web module:

 /** * jump the backend to a module */ function jump(url, modName, mainModName, pageId) { if (isNaN(pageId)) { pageId = -2; } // clear information about which entry in nav. tree that might have been highlighted. top.fsMod.navFrameHighlightedID = []; top.fsMod.recentIds['web'] = pageId; if (top.TYPO3.Backend.NavigationContainer.PageTree) { top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree(); } top.nextLoadModuleUrl = url; top.TYPO3.ModuleMenu.App.showModule(modName); } 

You can use it as follows:

 <a onclick="jump('alt_doc.php?&edit[pages][\'uid_page\']=edit','web_list', 'web', 'uid_page')" href="#"><span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-open">&nbsp;</span></a> 

Just replace "uid_page" with your correct uid :)

0
source

All Articles