Hello,

DHTML menu seems to destroy the tabs in the admin area (see attached screenshots). As soon as I active DHTML menu the tabs start looking very ugly.
I deactivated all other 3rd party modules to ensure the problem is really caused by DHTML menu. The latest development snapshot of DHTML menu does not solve the problem either.
I tried to track down what exactly is causing the problems, but I had no success so far. You will also find the HTML-code for the tabs and my the CSS-code for the tabs attached. Maybe that will help to find out, what the problem is.

Thanks for your support!

Comments

cburschka’s picture

Thank you very much for your detailed report!

I need to know two things to narrow down this problem to the PHP, Javascript or CSS parts of the module:

1.) Is the HTML fragment you attached above the one with DHTML Menu, or without? Is the markup any different when you disable/enable the module?

2.) What happens when you switch off Javascript - does it still look broken?

The thing is that DHTML Menu's CSS contains only two selectors, for .fake-leaf and .start-collapsed, neither of which is used by any other module (and which doesn't occur in your markup).

cburschka’s picture

Status: Active » Postponed (maintainer needs more info)
extect’s picture

Assigned: cburschka » Unassigned
Status: Active » Postponed (maintainer needs more info)

Thanks for your reply!

The problem persists even if javascript is turned off.
The HTML fragment is above the HTML-code of DHTML menu. I also tried to place the DHTML menu block in another region so that its HTML-code comes before the HTML-fragment for the tabs, but that didn't change the problem either.
I searched my entire Drupal installation for .start-collapsed and .fake-leaf, but DHTML menu is the only place where they are used. So, CSS shouldn't be causing the trouble.

Maybe I should have mentioned that my theme is a subtheme of the Zen theme and the problem is present in the Zen theme as well (it uses the same tabs). Perhaps you could try to install the Zen theme and check if you can confirm the problem (just in case there is something wrong with my Drupal installation).

vm’s picture

I can confirm this. I see the exact same thing using zen 6.x-dev.

cburschka’s picture

Assigned: Unassigned » cburschka
Status: Postponed (maintainer needs more info) » Active

I also tried to place the DHTML menu block in another region so that its HTML-code comes before the HTML-fragment for the tabs

Um, note that there is no "DHTML menu block" as such. When you switch on DHTML menu, the module changes the HTML of all menus, even outside blocks (for example the navigation below book nodes). Tabs are part of the menu system in a way, but I was sure that in 6.x-3.2 I had made sure that the module leaves tabs completely alone.

Thanks for telling me the specific theme, I'll try it out with Zen now.

extect’s picture

Assigned: Unassigned » cburschka
Status: Postponed (maintainer needs more info) » Active

Um, note that there is no "DHTML menu block" as such.

I know, I guess I wasn't precise enough. I just moved a regular menu to another region while DHTML menu was active to test if it makes any difference if the HTML-code for the menu comes before or after the HTML for the tabs. Unfortunately it didn't make any difference.

cburschka’s picture

Priority: Normal » Critical

Well, here we go with the markup. I'm marking this critical because I don't understand what my module is doing.

As you can see, DHTML Menu strips away the span.tab elements around links, which messes up the styling. I'll see if I can find out what is happening here.

<!-- with dhtml -->
<div class="tabs">
  <ul class="tabs primary clear-block">
    <li class="active" ><a href="/d6/node/4" class="active">Anzeigen</a></li>
    <li ><a href="/d6/node/4/devel/load">Dev laden</a></li>
    <li ><a href="/d6/node/4/devel/render">Dev render</a></li>
    <li ><a href="/d6/node/4/edit">Bearbeiten</a></li>
    <li ><a href="/d6/node/4/outline">Gliederung</a></li>
  </ul>
</div>
  <!-- without dhtml -->
<div class="tabs">
  <ul class="tabs primary clear-block">
    <li class="active" ><a href="/d6/node/4" class="active"><span class="tab">Anzeigen</span></a></li>
    <li ><a href="/d6/node/4/devel/load"><span class="tab">Dev laden</span></a></li>
    <li ><a href="/d6/node/4/devel/render"><span class="tab">Dev render</span></a></li>
    <li ><a href="/d6/node/4/edit"><span class="tab">Bearbeiten</span></a></li>
    <li ><a href="/d6/node/4/outline"><span class="tab">Gliederung</span></a></li>
  </ul>
</div>
cburschka’s picture

Looks like a bugfix/feature that /should/ have been committed already is not yet working properly.

Zen overrides {theme_menu_item_link}. DHTML Menu overrides it as well, and used to do it in a way that prevented themes from doing so, so this was definitely broken before.

However, DHTML Menu now is supposed to pass menu links on to the overriding theme function, so the below should get called. I'll test this a bit and have a patch ready soon.

/**
 * Implements theme_menu_item_link()
 */
function zen_menu_item_link($link) {
  if (empty($link['localized_options'])) {
    $link['localized_options'] = array();
  }

  // If an item is a LOCAL TASK, render it as a tab
  if ($link['type'] & MENU_IS_LOCAL_TASK) {
    $link['title'] = '<span class="tab">' . check_plain($link['title']) . '</span>';
    $link['localized_options']['html'] = TRUE;
  }

  return l($link['title'], $link['href'], $link['localized_options']);
}
cburschka’s picture

Wonder upon wonder - the function does get called, but $link['type'] isn't set properly and the function therefore does not recognize any link as a tab. More investigating...

cburschka’s picture

Status: Active » Needs review
StatusFileSize
new3.05 KB

Okay.

I am officially a dunce.

1.) Problem A: Themes have their overrides broken by DHTML Menu.
- Solution: Store the overriding function, call that instead of theme_menu_item_link.
2.) Problem B: Tabs get messed with by DHTML Menu, even though they can't possibly expand.
- Solution: If it's a tab, just call theme_menu_item_link and return early.
3. => Problem C: When generating tabs, themes have their overrides broken [... etc.]

In the process of fixing this problem (ie. always calling the overriding function, even when returning early) I have cleaned up some of the logic inside theming functions, including how the static variables get initialized.

Let's get testing =)

extect’s picture

Thank you for providing a patch so quickly. I tested it with different configurations and themes and its working quite well for me; no problems with the tabs so far. Looks really good.

But: Could you check if you can disable DHTML for certain menus (in DHTML menu 6.x-3.x-dev). That's not working here. It doesn't seem to have anything to do with this patch, but I don't want to open another issue before clarifying the problem.

cburschka’s picture

What happens if you check the "navigation" box in the list of menus to disable, then?

cburschka’s picture

Yes, I see that there are some problems - the links will still be duplicated, and you may need to reload the page. However, I have disabled the DHTML function successfully for the menu. Does it work the same way for you?

extect’s picture

I am using two menus: "navigation" and "privileged-navigation" (for certain user roles only)

If I disable DHTML menu for my "navigation" menu by checking the box for that menu in the settings of DHTML menu, the DHTML menu functions keep active for the "navigation" menu. Reloading the page doesn't help either. All the functions of DHTML menu stay active although it was correctly disabled for that particular menu.

Especially the sliding effect is causing trouble, because when clicking on a menu item, the menu expands for just a few milliseconds and than automatically collapses again. So there is no chance to keep a menu item expanded. However, this only happens after I disabled the DHTML function for my "navigation" menu. As soon as I enable it again, everything works fine.

So, to disable DHTML menu functions I have to disable the entire DHTML menu module, but of course this disables the DHTML menu function for ALL menus instead of disabling them for the "navigation" menu only.

cburschka’s picture

It's probably a regression caused by another change, since I'm sure I had it working in 3.0. I experienced the "open-close" problem too, but it went away on reloading... I'll need to investigate this further, but it needs a different issue. This patch seems to work as intended, so I'll commit it soon.

extect’s picture

Thank you! This Patch is indeed working quite fine.
Concerning the remaining problem with disabling DHTML menu, I just noticed that #332947: Do not touch menus where DHTML is disabled. is already dealing with it.

cburschka’s picture

Version: 6.x-3.2 » 7.x-1.x-dev
Status: Needs review » Patch (to be ported)

Committed to DRUPAL-6--3, now.

This issue exists in Drupal 7 (kinda).

cburschka’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new3.52 KB

Actually the issue itself should not exist, but the logic cleanup would do well in the D7 version too.

This probably needs testing.

adamtyoung’s picture

Patch does not help. I am still getting this error message on every book page.

andrewsuth’s picture

I am getting the same issue but with the 6.x branch of DHTML Menu.

I've narrowed the issue down to a conflict between DHTML Menu, Devel Theme developer module and possibly Zen theme.

I am using:
DHTML Menu 6.x-3.5
Devel Theme developer: 6.x-1.16
Theme: Zen 6.x-1.0 sub-theme (unedited)

tim.plunkett’s picture

Title: DHTML menu destroys tabs in admin area » DHTML breaks when Devel Theme developer is enabled

In 6.x it completely removes all of the sidebar blocks, both sides.
#499814: Incompatible with DHTML Menu? is effectively a duplicate, no one has figured out which module needs changing.

andrewsuth’s picture

Agreed.

tim.plunkett’s picture

Status: Needs review » Needs work
Aza-dupe’s picture

This issue occurs even in acquia_marina and acquia_slate themes (on 6.x) so its not specific to Zen.

skybow’s picture

Hi everybody,

I ran into the same problem with dhtml_menu (6.x-3.5) and theme developer.
I looked at the code and found, that dhtml_menu_theme_registry_alter misses support for theme developer.

Since I had exactly the same problem with extensions to signwriter 2.x where I used the same technique to intercept menu item generation, I came up with a solution that checks, if theme developer is enabled or not.

Since I don't have an easy CVS setup, I don't post the changes as patch. Instead you can take a look at the following code that replaces dhtml_menu_theme_registry_alter.

function dhtml_menu_theme_registry_alter(&$theme_registry) {
  global $theme;
  
  // Back up the existing theme functions.
  $themes = variable_get('dhtml_menu_theme', array());
  unset($themes[$theme]);
  foreach (array('menu_item','menu_item_link') as $hook) {
  	$intercept = 'function';
  	if ($theme_registry[$hook]['function'] == 'devel_themer_catch_function') {
  		$intercept = 'devel_function_intercept';
  	}
  	$themes[$theme][$hook] = $theme_registry[$hook][$intercept];
  	// Replace them with our own. These will "preprocess" and call the real functions.
  	$theme_registry[$hook][$intercept] = 'dhtml_menu_theme_' . $hook;
  }
  variable_set('dhtml_menu_theme', $themes);
}

Explanation:I did the signwriter stuff quite a while ago, so I can't fully remember every detail.
But: theme developer manipulates the theme registry as well, and for some reason (parameters were different) it is necessary to not replace the 'function' slot, if theme developer is turned on, but 'devel_function_intercept'.

So all you have to do is to use a different slot when theme developer is turned on.

Hope this helps. Also hope, that this change will make it into the project soon, although I haven't provided a patch file for it.

tim.plunkett’s picture

Version: 7.x-1.x-dev » 6.x-3.5
Status: Needs work » Needs review
StatusFileSize
new1.44 KB

what he said, except with a patch.

tim.plunkett’s picture

Version: 6.x-3.5 » 6.x-3.x-dev
Status: Needs review » Reviewed & tested by the community
tim.plunkett’s picture

*bump*

tim.plunkett’s picture

dhtml menu is a great module, and devel is a very popular and useful module. let's make them work together, for everyone.

jefkin’s picture

with Drupal 6.14

I just tried the patch on the 6.x-3.5 version against Theme Developer 6.x-1.18

And my DHTML menu is still trashed.

tuttkul’s picture

My menu also disappears when enabling theme developer. Is there a solution except disabling DHTML menu temporarily when using this great module? I really like theme developer, it saves me a lot of time.

tim.plunkett’s picture

jefkin: did you rebuild your menus and/or clear your caches? i'm running the same versions with no issues.
tuttkul: try applying the patch from comment #26
arancaytar: can we get this committed?

jefkin’s picture

I just tried, and received no love, though I get plenty of error messages, seems like one for each of my dhtml_menu's.

warning: Invalid argument supplied for foreach() in
/sites/all/modules/dhtml_menu/dhtml_menu.module on line 189.

nonzero’s picture

Component: Javascript code » PHP Code

Patch at #26 works for me.

Drupal 6.14
DHTML Menu 6.x-3.5
Theme developer 6.x-1.18

mattez’s picture

Patch here at #334296-26: DHTML breaks when Devel Theme developer is enabled works for me toooooo! THANX!

Drupal 6.14
DHTML Menu last 6.x-3.x-dev (2009-Dec-07)
Theme developer 6.x-1.18

mattez’s picture

Patch here at #334296-26: DHTML breaks when Devel Theme developer is enabled works for me toooooo! THANX!

Drupal 6.14
DHTML Menu last 6.x-3.x-dev (2009-Dec-07)
Theme developer 6.x-1.18

jacobson’s picture

Same for me with same versions of Drupal, DHTML Menu, and Theme Developer. Thank you.

gugucity’s picture

Version: 6.x-3.x-dev » 6.x-3.5
Component: PHP Code » User Interface

I have the same problem.
Drupal: 6.15
DHTML Menu: 6.x.3.5
Devel 6.x-1.18

Disable the DHTML Menu, devel theme developer works fine.

tim.plunkett’s picture

Version: 6.x-3.5 » 6.x-3.x-dev
Component: User Interface » PHP Code
Category: bug » task

I'm going to mark this as a task since there has been a working patch for seven months.
Please commit!

endiku’s picture

Not sure why this problem returned after it seemed to be fixed a while back. The break still occurs in Zen theme. I've fixed with a hackish look for whether it is a tab in function dhtml_menu_theme_menu_item_link($link)

  if ($link['tab_root']) {
    $link['title'] = '<span class="tab">' . check_plain($link['title']) . '</span>';
    $link['localized_options']['html'] = TRUE;
  }

And then a theme_menu_item_link change in template.php to check if dhtml_menu is installed

    if (!module_exists('dhtml_menu')){
      $link['title'] = '<span class="tab">' . check_plain($link['title']) . '</span>';
	}

Not a fix of dhtml_menu by any means but fixes the problem for the time being.

tim.plunkett’s picture

Category: task » bug

@endiku, is that problem occurring with or without that patch? I'm using Zen with DHTML Menu with no apparent issues.

Also, PLEASE COMMIT! It's been almost a year.

tim.plunkett’s picture

StatusFileSize
new1.44 KB
cburschka’s picture

Status: Reviewed & tested by the community » Fixed

Committed to DRUPAL-6--3.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.