Perhaps this should be two issues. I can break these off if need be.

1. Even though an item is, in fact, in a menu by virtue of being added via Taxonomy Menu, Vertical Tabs still gives a "Not in menu" tab summary, which could be confusing to the user.

2. I tried to do a string override in the settings.php file, which as I understood should work for any string being run through the t() function. Though I can override all the tab titles easily enough, this tab summary is getting set by modules/vertical_tabs/core/menu.js with the function:

Drupal.verticalTabs.menu = function() {
  if ($('#edit-menu-link-title').val()) {
    return $('#edit-menu-link-title').val();
  }
  else {
    return Drupal.t('Not in menu');
  }
}

I cannot seem to override this string. I don't understand how the t() function in drupal.js works. Is it really the same as a call to the t() function in common.inc, or does it somehow not read in the overrides that are hardcoded in settings.php (I only have about 5 and don't really want the string overrides or locale module just for that.

Comments

ergophobe’s picture

Regarding Part II - string can't be overridden, I'm fairly sure at this point that it's a problem with the core javascript t() function, which means it's a D6 issue, which presumably means it won't get fixed.

I ran this in Firebug with breakpoints set in drupal.js and vertical-tabs/core/menu.js and then stepped through.

I also set a watch for Drupal.locale.strings

Drupal.locale.strings is always undefined, so setting locale_custom_strings_en in settings.php doesn't seem to get strings into there.

At the watchpoints, the string is getting passed and would get translated, so this seems not to be a Vertical Tabs issue, so much as an issue where the php t() function and the js t() function have slightly different behavior.

When calling Drupal.t('Not in menu') in vertical-tabs/core/menu.js, you get

args: []
callback: "menu"
name: "Menu settings"

When I step into drupal.js with a breakpoint at line 80, I get

Scope chain
args: undefined
str: "Not in menu"

In all cases, locale is an empty object (defined in drupal.js line 3 as an empty object) and locale.strings is undefined.

So I doubt that part of it will be fixed and in any case, it's not a Vertical Tabs issue.

It would be nice to come up with something for Vertical Tabs that either
- recognized menu items created by Taxonomy Menu
- or just created no summary at all if not part of any menu.

dave reid’s picture

Category: bug » support
Status: Active » Fixed

You don't want to override the string. What taxonomy_menu should do is alter or override the actual JS used to generate the tab summary. That's not something we can support in vertical_tabs.module since it's not a core module.

ergophobe’s picture

Status: Closed (fixed) » Fixed

Okay, roger that on the fact that TM should handle the tab summary change.

Can you point me to a resource to get me started on how I would override javascript /vertical-tabs/core/menu.js - I'll give it a try, but not sure where to start.

Presumably I need to append/change values in Drupal.verticalTabs.menu. If I put it in my theme and load it with drupal_add_js() it will load after any module JS, so VT will set the value and I'll just set it again? That would work for me.

If it goes into the taxonomy_menu module and that javascript runs first, won't the VT just overwrite it (it doesn't check to see whether Drupal.verticalTabs.menu is set already). Sorry if those questions are misguided from the get go... I need to really get down with Drupal + JQuery, but so far haven't :-(

Barring that, though, it would be nice if VT would allow either overrides via settings.php or shutting off the tab summaries. As I said, I believe that the overrides issue is outside the scope of VT as it's the javascript version of t() that is not doing the translations.

That said, I'm only wanting to override the summary with an empty string so that it's not confusing to the user. As it stands, the user is getting a notice that the node id "Not in menu" when in fact it is, which is a bad user experience. It seems like it would be better to give no notice at all or at least have the option of shutting off this notice.

Status: Fixed » Closed (fixed)

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

Status: Fixed » Closed (fixed)

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