I'm guessing there's a similar problem for taxonomy term pages as #595744: Node page views when using Panels don't trigger Context reaction.

What I'm seeing is the context is not getting triggered on the term page for a term from the "Program" vocabulary even though it has Taxonomy term condition set for the "Program" vocabulary, with panels controlling the page callback for taxonomy/term/%taxonomy_term for (at least) this vocabulary.

Comments

finex’s picture

Bug confirmed using Context 7.x-3.0-beta2 and Panels 7.x-3.0-alpha3.

wjaspers’s picture

The problem is that the task handler name is different from the Page Manager than it is when viewing a specific term.
I've thought about writing a context module extension that picks up Page Manager arguments from the URL, but seems like more work than its really worth.

finex’s picture

What do you suggest? Would be possible to add an exception on the taxonomy term in order to check this specific case?

wjaspers’s picture

Fixing this particular bug should just be a patch, because the feature doesn't do what it describes. Sorry if my prior comment kinda sounded like I wanted to throw the ky-bash on fixing it.

nrambeck’s picture

StatusFileSize
new1.3 KB

I came across this same issue so I created a patch based on the code found in this issue: #595744: Node page views when using Panels don't trigger Context reaction

azinck’s picture

Can confirm patch in #5 works for me. Thanks!

azinck’s picture

Category: feature » bug
Status: Active » Needs review
Anonymous’s picture

Works fine for me as well. Great work!

EDIT: Can this patch be added in the next release please?

avitslv’s picture

#5 Patch works fine for "Taxonomy term" conditions, but does not work for specific "Taxonomy" conditions. I am overriding default taxonomy page with Panels. I am looking for a solution.. any help would be appreciated!

avits

hazah’s picture

I can confirm that this does what it's supposed to do. Works with taxonomy term. So far no observed side effects.

hazah’s picture

Has anyone confirmed if the same issue pops up for all of the other page overrides? Maybe, if the problem exists, then a patch should be concieved to handle all page types?

wjaspers’s picture

@hazah:
Its not supposed to know what to do on other page overrides. I grappled with this issue myself. Basically, each CORE page has a specific task name associated with it. That task name generally translates into something we can hook() onto using context and fire custom conditions/reactions.

Additional page types, such as /user/%user won't match a taxonomy term, even if a term field is attached to the user account because the task name is different. I tried to run down the course of scanning over each CTools context that was passed into the page and each custom relationship, but proper targeting turned into an absolute nightmare. I think its best to leave this development decision up to each site, rather than anticipate it being part of context's core.

Context and Panels can play "somewhat" side-by-side, but really approach the same problem from two very different vectors. Context attempts to detect X cases and make assumptions about what the user is viewing, carrying content/blocks from the site around with it. Panels tries to use the "context" inherited by the information passed into the page (namely being URL arguments). Panels can't "carry" content around (one definition for instance, would allow it to be displayed for a common condition across multiple pages--you have to define it again, and again... and again.).

In summary:
The /taxonomy/%term page will work as expected, but additional pages, like /user/%user will not.

hazah’s picture

@wjaspers I understand what you're saying. But I'm not sure we're on the same page. I am not interested in a condition that detects an override (such a feature would surely belong to panels, not context). Quite the opposite. I want the standard conditions that context provides to not be affected, at all, by the fact that a page is overriden. So when we're viewing the taxonomy/term/% "task name", the context fires regardless if it's a system page or a panel override of that page.

A little clarity...

I do use context and panels together but for two different purposes. I utilize panels for the hijacking of the primary content region only (system-main). I don't use panels to populate anything outside of that one region. I use context to decide the secondary content on the page(s) (side bars, headers, footers, anything that spans multiple pages as this type of content often does). In this way I don't have them overlap in function.

The trouble only really comes when I want context to NOT be aware that a page is overriden by a panel. Why should it be?

For instance, if you have a node holding some sort of profile information for a user (that's one specific case here), and you wish to display that information on user/% (or display one term page type differently), a panel override is a simple approach to change the main content region. But I want the rest of the system to not be aware that it's an override. I want the same blocks to appear around the main content as if I had not overriden that page. I believe it makes far more sense (from the perspective of 'least surprize') for the overriden page to be recognized as the same system page it overrides.

wjaspers’s picture

Aha, so you approach this the same way we do.

The trouble only really comes when I want context to NOT be aware that a page is overriden by a panel. Why should it be? .... I believe it makes far more sense (from the perspective of 'least surprize') for the overriden page to be recognized as the same system page it overrides.

Oh...I see. The page manager is selectively replacing the hook_menu callback for those pages. You should be able to write something to inspect/conditionally modify this behavior as you see fit. I don't have time to explore it at the moment, but my guess is you can change the "condition_met" values in some manner.

Either way...we're drifting a off topic from this thread...and I believe there's another issue open regarding the ability to "negate" a context as well.

hazah’s picture

I think the OT can be attributed to the need to explain the use cases and not doing a good job of it. :) my bad.

Currently this issue represents the exact same problem I have. Namely that "Taxonomy term pages managed by Panels don't trigger Context's "Taxonomy term" condition," which, I believe I am alluding to when I say "I want context to NOT be aware that a page is overriden by a panel". If it came across as a different concept, I appologize for the miscommunication, it was not supposed to.

Yes, I am aware of "negating" a context. As I understand it, that would only be relevant if panels creates an additional conditon for context to check for. My position is that a feature of this nature belongs to panels, not context. I hope that clarifies where I was going with that thought.

If replacing hook_menu is what's happening, I'm curious to know how that effects context... I haven't yet been able to navigate it properly so I'm unaware of how context depends on the original behaviour. From the sound of it it may very well be an issue that belongs to Panels. Especially if it turns out that Panels is sending different signals than the system pages. That actually sounds like the case.

Cheers.

wxman’s picture

I added the patch and it's now detecting context on my taxonomy term template panel page. What isn't working is the ability to pass term tokens. I'm trying to use context to add a description meta tag from the term description, like [node:taxonomy-vocabulary-4:description]. I've even tried to pass simple ones like [current-page:title] or [node:title] and it comes up blank.
Is this not working by design, or am I still doing something wrong?

eric.napier’s picture

Issue summary: View changes
StatusFileSize
new1.27 KB

I tested and this patch is working, I believe this should be committed. I had to re-roll the patch to get it to work for latest version of Context, but otherwise no alterations to the original patch.

eric.napier’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 17: taxononmy-term-handler-17.patch, failed testing.

eric.napier’s picture

Resubmitting renamed patch.

eric.napier’s picture

Status: Needs work » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 20: context-taxonomy-term-handler-1271324-20-D7.patch, failed testing.

eric.napier’s picture

Resubmitting again, fixed module path.

eric.napier’s picture

Status: Needs work » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 23: context-taxonomy-term-handler-1271324-23.patch, failed testing.

eric.napier’s picture

Tests are broken without the latest patch on this ticket applied, so I'm not sure how to proceed. See other recent patch submissions for same results: https://www.drupal.org/node/1421104#comment-10506482, https://www.drupal.org/node/2599644 (7 fail(s), and 12 exception(s)).

These tests need to be fixed else no further patches can be submitted for this module and marked RTBC.

eric.napier’s picture

resubmitting now that tests are passing

eric.napier’s picture

Status: Needs work » Reviewed & tested by the community
eric.napier’s picture

Would be great to see this committed!

nedjo’s picture

Tweaks:

  • Only test once for $page.
  • Test for $plugin object before executing it.

  • nedjo committed 1b7dc34 on 7.x-3.x authored by nrambeck
    Issue #1271324 by eric.napier, nedjo, nrambeck: Taxonomy term pages...
nedjo’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all, applied.

Status: Fixed » Closed (fixed)

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