0

i am new to context module and based on some tutorial i have used context. Now my problem is,

Currently, I have created one context which will show default header logo in all the pages. Now got new requirement to show different logo on the node pages with selected taxonomy terms.

For this i created one more context and used taxonomy conditions with selected taxonomy terms for the different header logo. when i visit the page, i got two logos in the header section, so i edited the first context and added the taxonomy condition and selected those taxonomy terms and set the "No" to "Set on node form" option.

You know whats happens, the default logo gets disappear from all the pages but still showing two logos in the node pages with the selected Taxonomy terms pages.

I am not sure what condition to set to show in all the pages except in those selected taxonomy terms pages. Could you please someone guide me on this.

1 Answer 1

2

This should work... Context allows contexts to be fired based on the presence of other contexts. So in your "global" context, you can add the condition 'Context(all)' and then add ~[taxonomy_context_id]. Where taxonomy_context_id is the id of the taxonomy context. Make sure that "Require all conditions" is checked. And save.

Now the "global" context should only show when the the other isn't available.

Recommendation: If you are looking to switch logos based on taxonomy term, you can use template_preprocess_page() to switch out the path of the logo based on the current menu_object that is loading. This allows for you to have a global context that persists and doesn't duplicate the work/blocks and provides an override to the page.tpl.php variables instead of multiple possibly conflicting context.

5
  • Thank you so much...:) Taxonomy_context_id means context name, right? is there any id related to context. Commented Jun 26, 2015 at 5:25
  • Yep, it means the context name.
    – timodwhit
    Commented Jun 26, 2015 at 13:53
  • I set the context as you said, its working fine in the node pages but in all other pages the global logo is not displaying...anything need to set... Commented Jun 26, 2015 at 14:00
  • You could try to put a star (*) in the "Context (all)". That will fire on all contexts except the taxonomy context. Also, in the global did you set you "global"
    – timodwhit
    Commented Jun 26, 2015 at 14:15
  • yeah i have set site wide contexts to active. Do you want me to only add star (*) in the second context or in the global context itself? Commented Jun 29, 2015 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.