Closed (fixed)
Project:
Context Plugin Extras
Version:
6.x-3.0-beta5
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
17 Aug 2011 at 15:33 UTC
Updated:
14 Sep 2011 at 21:17 UTC
Jump to comment: Most recent file
Comments
Comment #1
hadsie commentedNot sure I totally get it yet. So the condition would be if a specific taxonomy term is set on the node that you're currently viewing?
But ya, post it up here for sure.
Comment #2
othermachines commentedNot quite. The condition is vocabulary-specific rather than term-specific. For example: I'm viewing a news article. Since there is a menu context set for content type 'article', "News" is active in the menu. However, when I click on a linked tag within the article I lose the menu context and "News" is no longer active. This allows me to set the vocabulary as a condition so that I can retain menu (or other) context when taxonomy links are followed.
It seems strange to me that there isn't already a plug-in out there for something so basic. Or, if there is, I haven't found it.
Plugin attached...
Comment #3
hadsie commentedAhh, gotchya. Ya, I think there may actually be other ways to handle this instance in most use cases, but I can definitely envision a case where you would want it. I'm going to add this into the next release.
Just to confirm, this only ever apply to full page nodes though right? Or would it work on a teaser listing too?
Comment #4
hadsie commentedSorry, just read through the code in more detail and it looks pretty good, I've just made a couple minor changes to it that are listed below. I originally misinterpreted this as to be node related, but actually it's specific to taxonomy listing pages. This couldn't be accomplished by using the Path condition as you actually need to inspect the tid.
* I added $this->condition_used() to the execute method and removed the $map stuff in the hook_init as I believe that's a bit more reliable. The $map stuff didn't work at all for me in fact, I believe perhaps because Drupal was using a cached version and this plugin wasn't yet registered. (I'm not actually 100% about this as I haven't used the map technique before, but probably better to have a simpler init() function).
* I updated the description in the .info file to hopefully be a bit more descriptive ;-)
I think that's it. It's in git now.
Comment #5
hadsie commentedMarking as fixed as it's available now. Just created a dev release.
Comment #6
othermachines commentedAwesome! Glad to hear it. I'll mark this as closed.