Comments

I'll find some free time within next month to port it to D7. If you want to start working on this (and maintain D7 version), please let me know.

Subscribing

Title:D7 port?D7 port of Taxonomy Menu Trails

subscribe

subscribe

Any word on the progress of the port? Or maybe a preview?

Sorry, I was too busy. On the next weekend (or maybe earlier) I'll have free time and I'll spend it on porting to D7.

Status:Active» Needs work
StatusFileSize
new11.67 KB

Attached you will find a non working Drupal 7 port of this module. It was done using the coder module and does not show and errors. The only problem I have right now is, I have no idea why it does not work. Maybe it's a problem with the taxonomy menu integration.

So far I have updated the functions that have changed in the API. I have updated the function comments as well some code formatting. What's missing is an update of the SQL queries using the new DBTNG layer.

Subscribe to this topic.

@mikewink: porting to D7 is not so simple because "vocabulary <-> node type" relationships are fields now. For example, you can connect vocabulary with node type multiple times with different settings.

So, here are my plans for D7 port of Taxonomy Menu Trails (TMT):

  1. Separate settings for each content type (selection method, etc.)
  2. "Enable TMT" checkbox on term reference field form
  3. Module will probably use order of fields and term's weight to select term.
  4. Future versions will also support users and other field-powered objects, not only nodes.

I've already started working on it.

Hi Dmitriy.trt,

yeah I know, but I thought I would give you a basic skeleton for your work. :) Is the D7 code already on d.o? If so where do you need help?

@mikewink: Thanks for your code, I've used small part of it. Your name will appear in changelog and next commit.

Now I can't understand what fields' language is used for. For example, terms are grouped by language inside node fields. Right now I'm just using them all from all languages, but I'm not sure is it correct or not. If you'll find some documentation about it, this would be great.

I'll publish first 7.x-1.x-dev as soon as module will be ready for testing (probably today or tomorrow).

Okay I will check this. The best docu I have found on this topic is this one by Gábor:

http://hojtsy.hu/blog/2011-jan-31/drupal-7039s-new-multilingual-systems-...

If that's not enough I will search for more or contact Gábor. I can also help with the translation for Germany. I will test the module as soon as it is released.

@mikewink: Thanks for the article, looks like it will answer my questions. I'll read it tomorrow.
It can be funny, but sometimes I need help with "translation" to English. So if you'll find some labels or descriptions weird, please let me know. Translation for Germany will be great, of course. All translations is done through http://localize.drupal.org/ now, so you can contribute translation to German there.

I've created first 7.x-1.x-dev release. It will be packaged and available to download soon (dev releases are packaging twice a day). Or you can directly clone 7.x-1.x branch (instructions can be found from TMT project page, tab "Git instructions"). You can find module settings on node type edit form (additional vertical tab) and one checkbox on term reference field edit form (which is just for comfort, it duplicates one function of main settings). Module is still full of TODOs and for testing only, work is in progress.

There are two known bugs in core which prevents TMT to work properly:

Also, I've found more one bug recently, didn't have time to investigate it yet. Possible reproduce scenario is: first attach term to node, then change and save content type of this node. As a result, menu item linked to attached term will never become active (even if you're on term's page). I'll investigate it later.

I've commited some changes to 7.x-1.x branch. Bug described earlier is fixed by new method of active trail changing and menu cache clearing (in code, no needs to clean by hands). "Side effect" of this fix is breadcrumbs seems to work on node's page now.

Hello Dmitriy,

thank you for the work on the D7 port. I've installed the module and configured it for a content type. The problem is it does not seam to work at all times. When I reconfigure the settings the module does not work anymore and I never had a chance to get an active trail.

So could you please describe how to configure the module when I use the latest taxonomy menu. Thanks.

There are also some little code styling issues in the current release. Would you accept a patch to fix them?

@mikewink: I can assume you're not using the latest 7.x-1.x-dev release, because it is packaged not right after commit but two times a day. This bug should be fixed in the latest one published at April 6. If it is not, please let me know. Don't forget to clear all caches after module update. You can use git and checkout 7.x-1.x branch to be sure you have the latest code which will be published in next 12 hours as dev release.

I'll use Coder module to fix all code styling issues before stable release. If your patch fixes some issues Coder module not reporting, please post it. Thanks a lot for your help.

Hello Dimitry,

I did some slight changes to the obvious function comments in the module. I saw the todo that you will add the rest of the function comments. I also updated the info file a little bit to be more standard.

The module works for me quite well but I have not tested it thoroughly yet. One thing that strikes me right now is the missing "active" class on a leaf menu item. And I think I will send you another patch that add some meta information to the vertical tab in the content type settings. That gives you a fast overview about the current settings for taxonomy menu trails. What do you think?

+++ sites/all/modules/contrib/taxonomy_menu_trails/taxonomy_menu_trails.info (revision )
@@ -1,12 +1,12 @@
+package = Taxonomy Menu

Suppose package should be Taxonomy

+++ sites/all/modules/contrib/taxonomy_menu_trails/taxonomy_menu_trails.info (revision )
@@ -1,12 +1,12 @@
-; Information added by drupal.org packaging script on 2011-04-04
+; Information added by drupal.org packaging script on 2011-04-07
version = "7.x-1.x-dev"
core = "7.x"
project = "taxonomy_menu_trails"
-datestamp = "1301876790"
+datestamp = "1302136104"

useless, should be removed from patch

Powered by Dreditor.

Hello Andrey,

you are right the packaging informations are useless, but I know that Dimitry will take the useful parts. ;)

Regarding the package that is an option, because Taxonomy Menu Trails does not need Taxonomy Menu to work. So we should change to the package to Taxonomy as common ancestor.

Version:6.x-1.2» 7.x-1.x-dev

Package name "Taxonomy Menu" was derived from module with the same name. I don't want to change it because I suppose the most popular scenario is to use TMT together with Taxonomy Menu. This is convenient to have all these modules appear in one package. If Taxonomy Menu would change its package, TMT will follow it.

Thanks for patches, I'll use most of these changes in next commit (except those pointed by Andrey, of course).

@mikewink:

One thing that strikes me right now is the missing "active" class on a leaf menu item.

Menu items in active trail get "active-trail" class, which is correct because menu item is not really active.

And I think I will send you another patch that add some meta information to the vertical tab in the content type settings. That gives you a fast overview about the current settings for taxonomy menu trails. What do you think?

I think this would be great! Waiting for your patch. Please, don't use "Skip terms without enabled menu item" option for this functionality because probably I'll remove it soon.

Hello Dimitry,

attached the patch for the vertical tab informations. It works pretty well, maybe you change the labels a bit. There is one patch file that adds the #attached properties to the taxonomy_menu_trails_form_node_type_form_alter() and the needed .js file.

You are right with the "active-trail" class, but should the leaf not also have an "active" class? Right now the leaf has only! the "active-trail" class and not an "active" class.

Recent changelog:

  • Added "Deepest in menu" selection method. It finds active menu with term links in it first, then selects deepest term's menu item. If there are multiple items with same depth, select by weight.
  • Implemented optional integration with Taxonomy Menu - get menu item's path from it.
  • Option "Skip terms without enabled menu item" was removed, because now TMT selects from menu items, not terms.
  • Added vertical tab summary on node type form. Thanks to mikewink for this.

Still todos:

  • Migration from 6.x-1.x
  • Description for each function

I'll finish it in a few days and release first stable version. Please, test it and report any problems. Be sure you have the latest code (checkout from git branch 7.x-1.x or wait for next 7.x-1.x-dev version, packaging will happen at most 12 hours after this comment).

Migration code is ready for testing. First stable D7 TMT version will be released in next weekend. Please, test all features.

I'm still troubleshooting to figure out what exactly is happening, but I'm having a weird intermittent problem where suddenly for certain nodes TMT seems to not work. It kind of seems related to using a menu_block, but I'm not sure. Still digging...

@mikewink: the "active" class is only appropriate for menu items corresponding to the exact page you're looking at. Since a TMT term-leaf is one level *above* the current node, active-trail is correct in that case.

Turns out caching was causing the intermittent behavior, and menu_block is incompatible with TMT. Its function _menu_link_get_preferred() interferes with the $preferred_links stuff that TMT is doing. I think when #942782: Custom menus never receive an active trail gets fixed then menu_block won't need to do that anymore.

@markabur: Thanks for your research! I'll make TMT compatible with Menu Block. And yes, we're all waiting for #942782: Custom menus never receive an active trail to be fixed in D7 core, but TMT 7.x-1.0 will be released anyway (with workarounds, of course).

Commited workaround for Menu Block to 7.x-1.x. Please, test it.

Status:Needs work» Fixed

Everything seems to work now. 7.x-1.0 release it will be packaged in a few minutes. Thanks everybody for your help!

Sorry I didn't get a chance to test the menu block workaround until *after* the 1.0 release, but just did and it works great! Thanks!

Please be sure you've read important notes about 7.x-1.0 release on the project page.

@markabur: Thanks for testing!

Status:Fixed» Closed (fixed)

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