[Typo3-dev] Suggestion for alt_clickmenu.php

Robert Lemke rl at robertlemke.de
Wed Aug 18 12:22:06 CEST 2004


Hi folks,

if you want to create a second-level clickmenu, you can easily do that
by specifying a parameter "cmLevel=2" in the JavaScript calling the
clickmenu script. The kickstarter for clickmenus even adds a parameter
"subname" which acts as a unique identifier for your second-level menu.

Now, the problem is that most of the extensions which provide menuitems
for a second-level menu don't check the "subname" GET var and just add
themselves to the list. If you want to create a submenu which only
creates items you created in your own clickmenu, you have a problem.

The list of menuitems provided by extensions is created in
alt_clickmenu.php by the following method:

function processingByExtClassArray($menuItems,$table,$uid){
   if (is_array($this->extClassArray))	{
      reset($this->extClassArray);
      while($continueProcessing && (list(,$conf)=each($this-
>extClassArray))){
         $obj=t3lib_div::makeInstance($conf['name']);
         $menuItems = $obj->main($this,$menuItems,$table,$uid);
      }
   }
   return $menuItems;
}

Imagine your extension is at position number 2 of 5 in the list of
extensions ($this->extClassArray) - then you don't have a chance to keep
the other extensions adding their menuitems. As some workaround, I
suggest the following code:

function processingByExtClassArray($menuItems,$table,$uid){
   $continueProcessing = TRUE;
   if (is_array($this->extClassArray))	{
      reset($this->extClassArray);
      while($continueProcessing && (list(,$conf)=each($this-
>extClassArray))){
         $obj=t3lib_div::makeInstance($conf['name']);
         $menuItems = $obj->main($this,$menuItems,$table,$uid,
$continueProcessing);
      }
   }
   return $menuItems;
}

By setting $continueProcessing to FALSE an extension may stop processing
after delivering his version of menuItems and thus has full control over
the list of items.

Should we do it like this?

-- 
robert

"They placed me on this earth without a manual. 
 And I dare to say, I’m doing just fine without ;)"






More information about the TYPO3-dev mailing list